Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
1k views

I'm currently making a tool that will output Java class files for use based on user input. I have outputted a set of .java files, some of which reference classes and variables that don't exist in the ...
Jeff Demanche's user avatar
0 votes
3 answers
1k views

The section of code in question is: String fileToCompile = "C:/Users/Jeff/Documents/Test/Compiler 6/examplejavafile.java";//Absolute path JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); ...
Jeff Demanche's user avatar
1 vote
1 answer
509 views

I am looking for working examples of Oracle's Java Compiler API usage. I want to build something close to javac to customize/extend errors logging capabilities.
wilx's user avatar
  • 18.3k
-5 votes
3 answers
372 views

I have a situation where I need to compile classes dynamically. Following is the structure in which my java classes have been organized. // no package public class A{ } package test ; public ...
Pavan's user avatar
  • 9
11 votes
2 answers
3k views

I wish to compile source without having the dependencies present on the machine. Example: File A.java: import some.pkg.B; public class A extends B {...} I don't have B source present, I wish to ...
Chen Harel's user avatar
  • 10.1k
2 votes
0 answers
304 views

I am using Java Compiler Tree API for parsing java sources. Currently i have run into the following issue. Consider I have a method which uses imported varible of type "Foo". The class Foo resembles ...
malejpavouk's user avatar
  • 4,445
2 votes
1 answer
574 views

I am trying to visit method body with another treepathscanner, but I dont know, which parameter to pass, because I allways get a NPE in TreePath constructor. @Override public Object visitMethod(...
malejpavouk's user avatar
  • 4,445
0 votes
3 answers
396 views

I'm thinking of creating an in-game code IDE that uses a more restricted version of Java, for instance I do not want it to use the I/O stream APIs. Is this even possible? Also, inb4 this. It still ...
user1305495's user avatar
5 votes
2 answers
324 views

I am researching for a project that will involve my project to compile simple enough java files. From my research I have decided not to try and build my own compiler as this would just take too much ...
Hip Hip Array's user avatar
3 votes
2 answers
280 views

I have a problem regarding java.lang.NoSuchMethodError. This program is about Compiler API (JSR 199). When I create a prototype for this it run work, but when I try to make it to become library it ...
Crazenezz's user avatar
  • 3,466
0 votes
2 answers
3k views

I follow the tutorial from Generating Java classes dynamically through Java compiler API, the code is work but what I see is the program will create a class file after compiling it. import java.io....
Crazenezz's user avatar
  • 3,466
1 vote
1 answer
1k views

I am using the compiler Tree api to parse my code into a AST, but the method visitCompilationUnit is never called, althrough the method visitClass is called, what am I doing wrong? Second question: ...
malejpavouk's user avatar
  • 4,445
0 votes
2 answers
451 views

Everytime I add/create or copy a Project inside my Eclipse-Workspace it will be recognized as a Java 1.4 Project, which leads to a sum of errors. I have to fix this myself under properties->java-...
Rafael T's user avatar
  • 15.7k
4 votes
4 answers
11k views

I have a ClassLoader which loads a class compiled by JavaCompiler from a source file. But when I change the source file, save it and recompile it, the ClassLoader still loads the first version of the ...
Arian's user avatar
  • 3,231
-1 votes
3 answers
148 views

I have a sourcecode and in this source are two classes referenced. Now I want to compile this code via JavaCompiler but therefore I have to first compile the two referenced classes. Is there a ...
Arian's user avatar
  • 3,231
0 votes
2 answers
621 views

I got a java program which uses a JavaCompiler to generate new class files. I use jdk 1.6 within eclipse and this works fine. But when I export this as jar file and wan't to compile some .java ...
Arian's user avatar
  • 3,231
5 votes
1 answer
4k views

I'm using Eclipse and therefore my class files are stored in "bin" in the project folder. How can I set the JavaCompiler to output compiled classes into this "bin" folder? My code: File fRun = new ...
Arian's user avatar
  • 3,231
2 votes
2 answers
1k views

I want to compile a class from another class but every method I used throws a NullPointerException. Here's the code: File fRun = new File(fileToRun); DiagnosticCollector<JavaFileObject> ...
Arian's user avatar
  • 3,231
15 votes
5 answers
18k views

I accidentally wrote a java statement with two semicolons at the end. The java compiler does not show any error and it runs. Code: System.out.println("Length after delete the text is "+name.length(...
M.A.Murali's user avatar
  • 10.2k
0 votes
2 answers
2k views

I am creating a program along the lines of Codingbat.com. During Runtime, it needs to compile code, and then execute it. This has all been handled. Currently, I am forced to use the JavacTool, which ...
user avatar
2 votes
3 answers
612 views

Goal Detecting where comparisons between and copies of variables are made Inject code near the line where the operation has happened The purpose of the code: everytime the class is ran make a counter ...
tgoossens's user avatar
  • 9,886
6 votes
1 answer
5k views

Hi I have requirement to create ,compile and load java classes run time. Using FTL i am creating java source files , and able to compile the source if there is no dynamic dependency. To elaborate ...
Satheesh Cheveri's user avatar
0 votes
3 answers
178 views

Is there any way to compile BlackBerry Java code for different sections using eclipse ? There is a class named LocationInfo available in BB version OS 6.0 onwards. I get a compilation error if try ...
Raghuveer's user avatar
1 vote
1 answer
551 views

Using the Java Compiler Tree API, one can traverse the leaf tree of a TreePath and its children using a TreeVisitor. Is there a TreeVisitor implementation that visits all "nodes" in evaluation order? ...
Daniel Trebbien's user avatar
4 votes
1 answer
1k views

Given a Scope, is there a function that can generate a unique variable name such that a variable declaration for the unique name could be inserted in scope and the resulting source code/...
Daniel Trebbien's user avatar
1 vote
2 answers
398 views

So I've got some code - I'd like to compile the string 'temp' then execute it, then change the string, recompile and execute. Problem is that currently it's just executing the first bit of code first....
Joe's user avatar
  • 4,534
-1 votes
3 answers
6k views

Possible Duplicate: Compiling external .java files from within Java I have been using examples from all over the net but I keep getting NullPointerExceptions when invoking the run method in ...
The_Zykanator's user avatar
1 vote
1 answer
172 views

I'm using void afterUnmarshal(Unmarshaller unmarshaller, Object parent) in my beans and have got the complier set to fail if parameters are not used. The compiler seems to be okay with unused ...
Franz Kafka's user avatar
  • 10.9k
0 votes
1 answer
51 views

Using javax.tools.JavaCompiler and javax.tools.ToolProvider, I'm wrapping a user-input string (which should be a method) with a predefined class all within a large string and executing it within my ...
user1042485's user avatar
33 votes
3 answers
14k views

I have found many references explaining how to programmatically compile a Java class using the JavaCompiler class: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); int result = compiler....
Sergio's user avatar
  • 8,670
5 votes
2 answers
2k views

I got this Java code from another Stack Overflow thread import java.io.*; import javax.tools.JavaCompiler; import javax.tools.ToolProvider; public class Main { public static void main(String[] ...
user969931's user avatar
0 votes
1 answer
887 views

I am using this code to compile a Java file at runtime. First of all, here is my directory tree (in Eclipse). +---- src +----- package +------ Compile.java + + +---- temp +----- anotherpackage +------...
LanguagesNamedAfterCofee's user avatar
1 vote
1 answer
122 views

Is there a Java 5.0 equivalent to the Java 6.0 Compiler API? I'm trying to compile and jar some XmlBean schemas at runtime.
James's user avatar
  • 1,277
2 votes
3 answers
215 views

Situation: I'm making a simulator for plotting the time complexity of algorithms. The students can add load their own .java file to run it. My program compiles (with 'JavaCompiler') the .java file. ...
tgoossens's user avatar
  • 9,886
1 vote
1 answer
243 views

I have an application that has only signed jars, all by the same certificate, mine. I wan't to run the application with Webstart. The application runs a compiler, and the compiled code runs LWJGL. ...
RobotRock's user avatar
  • 4,497
0 votes
2 answers
1k views

I have read that Java 6 has a compiler api which allows you to compile java files from other java code. However whenever I try to import any such class (eg javax.tools.JavaCompilerTool), I get a ...
Coder's user avatar
  • 1,375
8 votes
1 answer
5k views

I wish to use the Java compiler tree in Eclipse. I have come across the API itself on the Oracle web site here, however I cannot find the JAR file for the library. Am I missing something?!
Joeblackdev's user avatar
  • 7,357
1 vote
4 answers
3k views

I have class file has a method like this: public boolean validate(String str) {} There're lots of codes inside this validate method, but I only want to make it always return true or false. Can ...
Sawyer's user avatar
  • 16k
1 vote
2 answers
2k views

I do not know how to set the source file for a compilationTask. I tried this: JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); List<String> optionList = new ArrayList<String&...
Muaz's user avatar
  • 65
10 votes
4 answers
5k views

Hello All I am writing some software that will allow users to create their own Java classes for a specific use in my software package. Obviously, my software will need to be able to invoke a Java ...
Marc's user avatar
  • 3,606
4 votes
1 answer
1k views

In answers to this question, I learned that it is not possible to invoke the Java Compiler in javax.tools from a GAE app. Does this limitation still apply? If so, what are my options for compiling ...
Tony the Pony's user avatar
2 votes
2 answers
1k views

I have the name of a variable/identifier, say, x, and the JCCompilationUnit and Scope. Is there a way to find the type of x?
simpatico's user avatar
  • 11.2k
1 vote
1 answer
363 views

Is there a way to invoke the Java source compiler via JavaCompiler in Google App Engine? (I didn't see any classes in javax.tools on the white list, so I'm afraid the answer is no) UPDATE I'm ...
Tony the Pony's user avatar
1 vote
1 answer
274 views

Possible Duplicates: using eval in Java Loading external source code and using them internally (by re-compiling or something) I want to simulate an 'eval' in Java such that the function takes in ...
Jade Somath's user avatar
2 votes
4 answers
1k views

I'm using Java Compiler API to compile in-memory classes. That is, classes are compiled to bytecode (no .classes files stored in disk) and then loaded by reconstructing the bytecode. Sometimes, I ...
halfwarp's user avatar
  • 1,800
6 votes
4 answers
3k views

Is there any tool which provides Java dynamic code generation and that also supports generics? Javassist for example, is the kind of tool that I need, but it does not support generics. I wrote a ...
halfwarp's user avatar
  • 1,800
1 vote
1 answer
147 views

I'm using the Java Compiler API to build a couple of classes at runtime. However, I'd like these classes to be compiled into the default compilation directory, to where other class files are generated....
halfwarp's user avatar
  • 1,800
2 votes
1 answer
844 views

As the title suggests, what is the classpath of classes compiled with Javassist? My scenario is: Class A is compiled with Javassist. Class B is compiled with Java Compiler API and references Class A. ...
halfwarp's user avatar
  • 1,800
4 votes
1 answer
2k views

In a project I'm currently working on, I need to generate Java classes at runtime. I also need to avoid using reflection when using these classes later on. I've been search for current solutions to ...
halfwarp's user avatar
  • 1,800
11 votes
6 answers
15k views

MyClass.java: package test; public class MyClass { public void myMethod(){ System.out.println("My Method Called"); } } Listing for SimpleCompileTest.java that compiles the MyClass....
java_geek's user avatar
  • 18.1k