java-7

jdk7: sun.font.fontManager replacement/how to get filename information from fontname

萝らか妹 提交于 2019-12-01 05:05:48
Using Oracle(Sun) JDK6 and trying to move to Oracle JDK7 I am using sun.awt.GraphicsEnvironment to find all system fonts in order to use them to change pdf font used in my pdf file. Here is the exact code I am using: GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); // get all system fonts final Font[] fonts = gEnv.getAllFonts(); After that I will need to get the exact font file path on the system, so I use: FontManager.getFontPath(true) + "/" + FontManager.getFileNameForFontName(font_name); The problem now is that sun.font.FontManager is no longer a class and has

Understanding how to resolve “Inconsistent stackmap frames” exception

寵の児 提交于 2019-12-01 04:29:09
问题 I get an exception on startup of the web application as guice is trying to construct the class mentioned. java.lang.VerifyError: Inconsistent stackmap frames at branch target 2770 in method com.aptusi.apps.magazine.api.servlet.internal.EditorServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Lcom/aptusi/persistence/runtime/framework/DboSession;)V at offset 200 at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang

Does using the 'this' keyword affect Java performance?

混江龙づ霸主 提交于 2019-12-01 04:16:20
Does using the this keyword affect Java performance at all? In this example: class Prog { private int foo; Prog(int foo) { this.foo = foo; } } Is there performance overhead doing that over the following?: class Prog { private int foo; Prog(int bar) { foo = bar; } } A couple of coworkers and I were discussing this earlier today and no one could come up with an answer the we all agreed on. Any definitive answer? No, not at all. It is just a different syntax for the same thing. It gets compiled into exactly the same piece of bytecode. So say it like a human: you are telling the compiler twice

Is it possible to have a translucent windows in java 7 including a title bar?

点点圈 提交于 2019-12-01 04:07:21
Related to this question: Is The Java Tutorials Translucent Window example giving trouble to those playing with jdk7? with jdk1.6.0_26 I seem to be able to apply translucency to a JFrame, but not so with jre7: NativeException: java.awt.IllegalComponentStateException: The frame is decorated ex (jruby scripting java, works jdk1.6 not with jdk7 though): require 'java' class MouseDraw def self.go java_import 'javax.swing.JFrame' java_import 'com.sun.awt.AWTUtilities' f = JFrame.new AWTUtilities.set_window_opacity(f, 0.5) f.set_size 200,200 f.show end end MouseDraw.go So my question is "is it

Is there a Java 7 to Java 6 converter?

江枫思渺然 提交于 2019-12-01 03:35:15
Android SDK requirements state that either JDK 5 or JDK 6 is required. However, I have a Java class library written in Java 7 and I would like to use it for my Android project. Instead of manually converting Java 7 to Java 6 by hand, I was wondering if anyone know of a converter that could do this job for me? Or do we have to code one up from scratch? Do you have the source for the JAR? If so, you can use the javac -target parameter set to either 5 or 6 to generate either Java 5 or 6 class files. See this page . 来源: https://stackoverflow.com/questions/8869869/is-there-a-java-7-to-java-6

IntelliJ switch statement using Strings error: use -source 7

天大地大妈咪最大 提交于 2019-12-01 03:21:10
I'm trying to use IntelliJ (on Mac OS X) to compile some code I wrote using Eclipse. I've attempted to run the following code: switch (category) { case "below 20": below20++; break; case "20 to 29": to30++; break; case "30 to 39": to40++; break; case "40 to 49": to50++; break; case "50 to 59": to60++; break; case "60 to 69": to70++; break; case "70 t0 79": to80++; break; case "80 to 89": to90++; break; case "90 to 99": above90++; break; default: break; } However, I get the error: java: strings in switch are not supported in -source 1.6 (use -source 7 or higher to enable strings in switch) I

How do I get unit test to run in java 7: java.lang.VerifyError: Expecting a stackmap frame at branch target

ⅰ亾dé卋堺 提交于 2019-12-01 02:54:47
Hi I am running a maven test using maven 3.0.3 with hibernate 4.0.0 Final release and spring 3.1 on jdk7 update 2. I get the following error. Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 63 in method ${myDomainClass}.equals(Ljava/lang/Object;)Z at offset 24 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.getDeclaredMethods(Class.java:1808) at org.hibernate.property.BasicPropertyAccessor.getterMethod(BasicPropertyAccessor.java:352) at org.hibernate.property

Code not executed without a print statement [duplicate]

家住魔仙堡 提交于 2019-12-01 02:15:27
问题 This question already has an answer here : Loop doesn't see value changed by other thread without a print statement (1 answer) Closed 4 years ago . i've been making a countdown program, and i came up with this. package main; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem

jdk7: sun.font.fontManager replacement/how to get filename information from fontname

时光总嘲笑我的痴心妄想 提交于 2019-12-01 02:11:19
问题 Using Oracle(Sun) JDK6 and trying to move to Oracle JDK7 I am using sun.awt.GraphicsEnvironment to find all system fonts in order to use them to change pdf font used in my pdf file. Here is the exact code I am using: GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment(); // get all system fonts final Font[] fonts = gEnv.getAllFonts(); After that I will need to get the exact font file path on the system, so I use: FontManager.getFontPath(true) + "/" + FontManager

Does using the 'this' keyword affect Java performance?

二次信任 提交于 2019-12-01 01:46:03
问题 Does using the this keyword affect Java performance at all? In this example: class Prog { private int foo; Prog(int foo) { this.foo = foo; } } Is there performance overhead doing that over the following?: class Prog { private int foo; Prog(int bar) { foo = bar; } } A couple of coworkers and I were discussing this earlier today and no one could come up with an answer the we all agreed on. Any definitive answer? 回答1: No, not at all. It is just a different syntax for the same thing. It gets