Skip to main content

All Questions

Tagged with
0 votes
1 answer
83 views

javac reports "package does not exist" even though classpath is set

I have a file Test.java (stripped down for debugging): import com.github.tkutche1.jgrade.Grade; I try compiling it with this command line and get an error: # javac -cp lib/com/github/tkutche1/jgrade/...
Ellen Spertus's user avatar
1 vote
0 answers
2k views

Downgrading java version in project (IntelliJ)

I am trying to downgrade the target build version of java, but somehow I can´t change it within IntelliJ, don´t understeand why. Under File -> Project Structure -> Projects I changed the ...
WinterMute's user avatar
4 votes
1 answer
214 views

Problem marking the lines in the java compiler

I am a master's student and I am researching static analysis. In one of my tests I came across a problem in marking lines in the java compiler. I have the following java code: 226: String json = &...
Matheus Barbosa's user avatar
0 votes
0 answers
76 views

Java: Safety of rewriting bytecode to add interface

To try to forestall any concern, this is for a personal project. I'm more interested in learning about the internals of the jvm than I am in hearing about what a horrible idea this is :) Normally, ...
David Kleszyk's user avatar
2 votes
1 answer
341 views

Stack=4 in Java bytecode. How does the Java Compiler compute the 4 value? (depth of the the stack)

Java Code: public class SimpleRecursion { public int factorial(int n) { if (n == 0) { return 1; } return n * factorial(n - 1); } } Gives the following ...
Youness's user avatar
  • 57
1 vote
0 answers
2k views

setting the target version to 1.8 still produce the class files with major version 52

I am trying to compile my java source code to target 1.8. I have set the following in the javac target. Ant version: Apache Ant(TM) version 1.9.4 compiled on April 29 2014 Java version: 1.8 <...
Mayuran's user avatar
  • 708
3 votes
2 answers
3k views

Using javap for reading the byte code

I figured out by reading in the internet that java compiles public class Test { private String s = "TESTTEST"; } to public class Test { private String s; public Test() { s = "...
mrbela's user avatar
  • 4,617
5 votes
4 answers
2k views

Java: initialization and costructor of anonymous classes

I would like to understand a strange behavior I faced dealing with anonymous classes. I have a class that calls a protected method inside its constructor (I know, poor design but that's another story....
ugo's user avatar
  • 181
3 votes
3 answers
2k views

What are the differences of explicit and implicit instantiating String class in java

I have been told that creating String instance like this String s = new String("Don't do this"); // explicit has a performance problem since it creates two instance of string on for double quoted ...
Morteza Adi's user avatar
  • 2,453
-2 votes
5 answers
5k views

.java file path to class name

What's the most efficient way of getting the class(es) created on a .java file? I have the .java file path and I need to get the class full name. I can only remember: Compile it with JavaCompiler ...
rnunes's user avatar
  • 2,835
2 votes
2 answers
964 views

What javap -c does to a classfile?

Actually, the question is a bit broader. I know that javac compiles java file into a bytecode, a class file. So, class file should contain jvm instructions and all that. On the other hand, the only ...
dhblah's user avatar
  • 9,971
1 vote
1 answer
751 views

.class file doesn't have LineNumberTable

In our product there are a few jdk 1.6.0._17 compiled java source files. They are not giving the line numbers whenever there is an exception in any one of them. I used javap to find out more about ...
Vijay's user avatar
  • 101