Compile a jar file
I hope this is in the right forum.
I have make some changes to a jar file, but now when I want to compile it it gives me an error "Path not found.
The bat with my code and the jar file is in the same folder.
Here are my code, I think it is correct.
"C:\Program Files\Java\jdk1.6.0_23\bin\jar.exe" cfm C:\Bybel\Afrikaans.jar META-INF\MANIFEST.MF
No the Manifest,mf file is in the jar fileSo why are you naming it on the command line?
I did make a folder Manifest and put the file manifest.mf in the folder.Yet on the command line you didn't say Manifest/MANIFEST.MF. You said META-INF/MANIFEST.MF. Which won't work, because according to this it doesn't exist.
that I need to compileYou don't compile JAR files. You create them.
it I just make a jar file and load it into the phone it gives compile error.The phone has a compiler in it?
You seem to be using the word 'compile' pretty indiscrimately.
Similar Messages
-
Need help compiling external jar files into my one jar file from cmd line
Here is my problem, let me see if I can explain it right:
I am making a jar file on my development computer that will run my java project. In this java project, it references a couple Java3D jar files. On my development computer, I create the jar file and it runs correctly, but when I move that jar file over to the test computer, the parts of the application needing those Java3D jars are not found in my jar I created. I isolated the problem and it is because those Java3D jar files I needed are not on my test machine. But that is the way I need it to be. I need it so that when I compile all my code on the development machine, I need it to also compile those two Java3D files into my one jar that I move to the test machine. You get what I'm saying? I must do all the compiling from the command line and have only one jar file to put on the test machine that contains all my compiled code and the two Java3D files needed to run some of the applications in the project.
Here a brief sample of what I'm doing:
To compile my java files in my project, I simply to this for all my files:
javac file.java
javac file2.java... and so on for all my java files.
Then I create my jar file:
jar -cfm MyJar.jar manifest.mf file.class
jar -fmu MyJar.jar manifest.mf file2.class... and so on for all my class files.
Also when compiling my jar file, I do this thinking that it would include the two Java3D jars into my one jar file:
jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
My manifest file looks something like this:
Manifest-Version: 1.0
Main-Class: Main
Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar
Do I have to have that Class-Path in there pointing to those jar files? Those jar files will not exist on my test machine because the directory structure will not be the same. I've tried a manifest without specifying my Class-Path to those jar files, but I get the same problem when I run my application on the part that needs the Java3D files.
The error I am getting is that there is a RasterTextLabel class inside one of those Java3D jar files that my application cannot access because those jar files are not on my test machine.
So basically what I really need to know is how I get those two Java3D jar files compiled into my one jar file that I move to a test machine and run with the following command:
java -jar MyJar.jar
Can anyone help me??
Thanks.Here what you need is to have all the files present in a single jar file, and the classpath is set properly to the required jar files.
Do the following in steps:
1)
Create a custom manifest file,say mymanifest.mf, with the following contenets, put it in current directory:
Manifest-Version: 1.0
Created-By: 1.4.0_01 (Sun Microsystems Inc.)
main-Class: Main
Class-Path: jars/j3d-org.jar jars/j3d-org-images.jar <press ENTER key>
2)
jar -cfm MyJar.jar manifest.mf file.class
jar -fmu MyJar.jar manifest.mf file2.class... and so on for all class files.
3)
jar -fmu MyJar.jar manifest.mf jars/j3d-org.jar
jar -fmu MyJar.jar manifest.mf jars/j3d-org-images.jar
(Make sure that j3d-org-images.jar and j3d-org.jar are present in a subdirectory called 'jars')
Now you would be able to run,
java -jar myjar.jar -
hi,
we are working on a tcp/ip socket programming application. We need to ship the client code(class files) by converting it into a jar.
The problem:
When we are accessing the classes thru the prompt, it runs fine. but when we create a jar file it doesnot acccess the classes.
we are using the following for generating hte jar file:
jar -cfvm Client.jar manifest.mf *.*
hte manifest file contains
Main-Class: Client
Please help.
with regards,I think he/she means that when they compile the
classes wit javac and run the main class with java it
works. But when they build a jar file it doesn't run
the main classthats right.
The manifest file has a carraige return.
In fact even the main class is called but then the server give 100%memory usage and then the client and server both hang.
with regards, -
Hello,
I have an application that I have been asked to take over and finish. This application has several jar files, but I only need to alter code that resides in one of the jar files. How do I recompile my code that is also dependant on the other jar files? Do I need to unjar everything recompile my code and then jar everything back up OR can I just leave the jars that don't need altered as is and recompile the one jar file by itself? Thanks,
KellyThanks for the help, I'm having a bit of difficulty getting the command correct. Let's say I have:
one.jar
two.jar
three.jar
I unjarred one.jar and made some changes to x.java.
I typed in:
javac -cp /path/two.jar /path/three.jar /path/x.java
but it's not working. Thanks in advance! -
Hi,
I'm trying to run a very simple jdbc testapplication that uses jdbc drivers from M$. The problem is that i don't know how to run a .class file which depends on jar files (from the commandprompt).
This is what i get:
javac dbtest.java -classpath msbase.jar;mssqlserver.jar;msutil.jar
No problem!
java -classpath msbase.jar;mssqlserver.jar;msutil.jar dbtest
Exception in thread "main" java.lang.NoClassDefFoundError: dbtest
Why isn't my Main method found?Complete source:
import java.io.*;
import java.net.*;
import com.microsoft.jdbcx.sqlserver.*;
import java.sql.*;
public class dbtest
static Connection conn = null;
public static void main(String argv[])
System.out.println("Starting Sql...");
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
try{
conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.1.25:1433;DatabaseName=ucc;User=sa;Password=sa");
Statement stmt = conn.createStatement();
stmt.execute("select * from tblUser");
ResultSet rs = stmt.getResultSet();
while (rs.next()) {
System.out.println(rs.getString("FName") + " - " +
rs.getString("LName"));
catch (SQLException e){
System.out.println("SqlException:" + e);
catch(ClassNotFoundException e){
System.out.println("error connecting to database" + e); -
Compiling a jar or zip file with Ant
Hi,
I am using Java 1.4.2 and Ant 1.6.1
I am trying to use the javac task to compile a jar file and a zip file directly (i.e. they contain compressed .java files) instead of uncompressing them first and then compiling them. Is it supported in Ant?
i.e.
<target name="compileinit">
<mkdir dir="${compile.outdir}"/>
<!--Compile Java source files in a jar file-->
<javac destdir="${compile.outdir}" debug="on">
<classpath refid="classpath"/>
<src refid="srcpath"/>
<include name="jarfile.jar"/>
<include name="zipfile.zip"/>
</javac>
</target>
Thanks!It's not clear what you are asking. Maybe this will help
http://www.cfdev.com/code_samples/code.cfm/CodeID/83/Java/Simple_Ant_build_xml_Build_Task -
Can javac compile a jar of source files?
I create a jar of my source once exported from CVS to make it easier to distribute. Once I'm on the machine that I want to compile , I extract the jar (source) and then compile it. Is there a way to compile the jar file?
ie >>javac -jar mySrc.jar mainFile.java
or >> javac -sourcepath mySrc.jar mainFile.java
thanks for any help.Not as far as I know.
-T- -
Error after deompiling JAR file
Dear Everyone,
I decompile a JAR file and re-save the java files.
After that I use the Wireless Toolkit to recompile the same files back.
BUT the java files always gave me 100 errors when I compile them.
I have successfully compiled some JAR files before.
Is there any idea what should I do?Is there any idea what should I do?Yes, stop decompiling and stealing code.
-
Cannot create a proper working JAR file
Hie,
Im facing a problem here to compile the JAR files. I went through the JAR tutorials at the java site but i cant still figure it out. MY problem is actually i need to create a JAR file that consist 3 folders and subfolders.
The main folder is --> classes
sub main1--> emmeeting
submain2-->image
submain3-->jwc
But, in this jwc it contains another two folders and there is another 3 folders inside those subfolders.
jwc ---> contains jwc 1 and jwc 2 as subfolder
jwc1 contains jjwc1. jjwc2 and jjwc 3
those filenames are examples only.
i used the command jar cvf classes.jar classes * class
and
even jar cf classes.jar -C emeeting. -C images . -C jcw
as these command will invoke every file inside it and create a jar but i still fail
When i click the jar that is created it says this error "Fail to load Main-Class Manifest attribute"...i went through the manifest and they say have to set up the main-class : classname .....so, which classname shud i use and plz tell me the best way to solve this .thanksThe main classname should be the path of the class which contains your static "main" method.
/mypackage/MyClassWithMainInIt
Regards,
Tim -
How to retrieve constants value from compiled code in jar file?
Hi everyone,
I've been looking for a way to solve this for a week now, without any much success... and I've finally decided to ask the Java gurus for a solution! :-)
Here's what I am basically trying to do:
I have several jar files in which there are only compiled code (.class).
In every class, there are 2 constants (declared as static final String) that I would like to retrieve (one is the version and the other the date of the last modification).
My goal is to print a list of all the classes in the jar files with the values of these 2 constants for each class.
The solution that I have right now to do this does not work properly: for now, I read all the elements of the classpath, check if these are jar files, and if so, I look into each one and load all the classes one by one and print the results.
The problem with this is that it uses the method Class.forName(className) and as some classes are unfortunately present in many jar files (2 or 3 copies), once the classes have been loaded, then it won't be "reloaded".
Without the possibility to "reload" these classes, I cannot see inconsistencies in the versions of the classes present in the jar files.
I have read many articles, and I thought that I could then use a custom classloader and create a new instance of this classloader for each jar file.
2 problems with this:
- according to many posts in the different forums I have read, the jar files should not appear in the CLASSPATH (but this would be easier for me if I could use it...)
- some classes will not be loaded if some classes (present in other jar files) are not loaded... and this makes things really really complicated to implement...
So, I thought that I was maybe doing this the wrong way, and that there might be an easy way out of this...
In fact, I do not need to load the classes... all I need to do, is take a sneak peek at the constants and print their values... and that's it!
Somehow, I think that this is possible to retrieve the values of compile time constants (declared as static final String) as I can see that with Eclipse (when opening a jar file).
So, my question is: how can I do that within my java application?
Or maybe there is another easier solution to do what I need?
Thanks in advance for your help!Hi everyone,
I've been looking for a way to solve this for a week now, without any much success... and I've finally decided to ask the Java gurus for a solution! :-)
Here's what I am basically trying to do:
I have several jar files in which there are only compiled code (.class).
In every class, there are 2 constants (declared as static final String) that I would like to retrieve (one is the version and the other the date of the last modification).
My goal is to print a list of all the classes in the jar files with the values of these 2 constants for each class.
The solution that I have right now to do this does not work properly: for now, I read all the elements of the classpath, check if these are jar files, and if so, I look into each one and load all the classes one by one and print the results.
The problem with this is that it uses the method Class.forName(className) and as some classes are unfortunately present in many jar files (2 or 3 copies), once the classes have been loaded, then it won't be "reloaded".
Without the possibility to "reload" these classes, I cannot see inconsistencies in the versions of the classes present in the jar files.
I have read many articles, and I thought that I could then use a custom classloader and create a new instance of this classloader for each jar file.
2 problems with this:
- according to many posts in the different forums I have read, the jar files should not appear in the CLASSPATH (but this would be easier for me if I could use it...)
- some classes will not be loaded if some classes (present in other jar files) are not loaded... and this makes things really really complicated to implement...
So, I thought that I was maybe doing this the wrong way, and that there might be an easy way out of this...
In fact, I do not need to load the classes... all I need to do, is take a sneak peek at the constants and print their values... and that's it!
Somehow, I think that this is possible to retrieve the values of compile time constants (declared as static final String) as I can see that with Eclipse (when opening a jar file).
So, my question is: how can I do that within my java application?
Or maybe there is another easier solution to do what I need?
Thanks in advance for your help! -
How do I add a jar file into the build path of the compiler?
Hey,
I'm trying to import a jar file into the build path of the compilation process, but it does not find the packages or the classes that are in it.
I think I don't add it right...
ArrayList<String> options=new ArrayList<String>();
options.add("-d");
options.add(targetDirectory);
options.add("-classpath");
for(String str:includeDirectory)
options.add(str);
if (!compiler.getTask(writer, fileManager, diagnostics, options, classes, compilationUnits).call());
....and I've tried this way:
public void setTargetDirectory(String targetDirectory) {
this.targetDirectory = "-d " + targetDirectory;
private void compile(Iterable<? extends JavaFileObject> compilationUnits) throws Exception {
ArrayList<String> options = new ArrayList<String>();
options.add(targetDirectory);
String classPath="-cp ";// tried this also with "-classpath"
for (String str : includeDirectory)
classPath+=str+":";
options.add(classPath);
if (!compiler.getTask(writer, fileManager, diagnostics, options, classes, compilationUnits).call())
// throw new Exception("Compilation Error");
}Thanks in advance,
Adam.
Edited by: Adam-Z. on Feb 24, 2010 5:41 AM
Edited by: Adam-Z. on Feb 24, 2010 5:42 AMThank you for your reply,
Q: Are there .class files in that directory in that jar file? (the compiler doesn't ( can't )) look for directories, it can just look for specific files , and scan to get a list of all files matching certain criteria. So if there are no class files, it will say the package doesn't exist, even if there is a directory, possibly containing other files.yes there are class files in the jar, the tree structure:
j2MeDataChunkGenerator_Plugin\(lots of class files)
META-INF\manifest.mf
and thats it.
, your code will only work on windows because other platforms use a different path separator. You should use java.io.File.pathSeparator not explicit ';" when building your classpath. (this is unrelated to your problem, but you should correct it)will do, thanks.
Q: Is that error in your post formatted by your own diagnostics? (we could possibly help you better if we didn't have to guess!!)I would not post my own error code, this text is generated by the compiler diagnostic.
{code}
System.err.println(" Error details: " + diagnostic.getMessage(null));
{code}
Q: Is line 3 of ImageCroper_Editor.java (sic) an import statement? (we could possibly help you better if we didn't have to guess!!)it is an import error... didn't the error message stated that it is an import problem? wired, I'm sure before it did. anyway it is an import error.
Also you don't show us what the variable includeDirectory is in terms of type, and contents, that might be helpful. (we could possibly help you better if we didn't have to guess!!)It has only one String object: "D:\%Important Documents\WorkSpaces\PacMan\ApplicationManager\Plug-in\Data Chunk Designer.jar"
the last file on the classpath list.
Q: Have you proven this? that i did post, in this long line of text.
Q: Is the compiler finding other classes (in other packages) in that same jar file?No. all the class files are in the jar, they all have entries that start with "j2MeDataChunkGenerator_Plugin\*.class", and since I get 47 errors I guess it does not load any other class.
thank you for you comments, the problem with having these errors, is that I can't even get a piece of information where this error is coming from, only that it is an import loading error package not found, what does that mean? that the jar was not loaded in compilation(no error about this), that the jar is corrupted(no error about this), that the path is incorrect(it is correct I made sure), that there is no such package in the jar(There is), that the compiler does not load the package(does it even do that?), really I can't even guess why this happens, I've been at this on and of all day today, really annoying.
Thanks,
Adam. -
Error while compiling Web Dynpro program due to missing JAR files
Hi Experts,
I am getting error message while compiling Web Dynpro program. The erring lines are as below:
Message message = new MimeMessage(session);
try {
message.setFrom(new InternetAddress(fromMailId));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(toMailId));
message.setSubject(mailSubject);
message.setText(mailBody);
message.setHeader("X-Mailer", "E-Mail");
message.setSentDate(new Date());
Transport.send(message);
The error messages are:
Message.ReceipientType can not be resolved
The method send(Message) is undefined for the type Transport
The method setFrom(InternetAddress) is undefined for the type Message
The method setHeader(String, String) is undefined for the type MessageThe method setSentDate(Date) is undefined for the type Message
The method setSubject(String) is undefined for the type Message
The method setText(String) is undefined for the type Message
Type mismatch: cannot convert from MimeMessage to Message
Can you please help me in resolving the issue. It seems that some API is missing. I believe if some one can tell me the name of JAR file / API then I will be able to sort out the issue. I will add these JAR file in my program.
Thanks,
SHI Stuart,
you are missing the jar files required for sending mail in java
Installing JavaMail
You will need the latest version of JavaMail (Version 1.2) available here:
http://java.sun.com/products/javamail/
Download and unzip the file, in the newly created top level JavaMail directory you will find a number of jar files,
these need adding to your classpath.
To do this in Eclipse, right click on your project in the tree view, select properties, select the libraries tab.
Now click the 'Add external jars' button, navigate to your JavaMail directory and click on the jars.
The tutorial also makes use of the Java Activation Framework, which is available here:
http://java.sun.com/products/javabeans/glasgow/jaf.html
Instalation of JAF is identical to JavaMail
activation.jar / mail.jar are 2 distinct names i remember rest you will get above
P.S: close the question to assist other users narrow the search and find solutions
Message was edited by:
Armin Reichert -
In PI 7.1 - Java UDF's Compiled Class files - Jar File location
Hi All,
In PI 7.1 Does anybody know where the compiled Java UDF's (which are used in Graphical mapping) class files stored in jar are located in integration server? I want to use this jar file in my XSLT mapping.Hi,
I guess it would be under
\usr\sap\<SID>\DVEBMGS00\j2ee\cluster\server0\temp\classpath_resolver
or
\usr\sap\<SID>\DVEBMGS00\j2ee\cluster\server0\.\temp\classpath_resolver
Where SID is your XI instance name.
Thanks,
Gujjeti
Edited by: Praveen Gujjeti on Jun 23, 2008 5:12 PM -
How to include jar files in ant script for compiling
i am trying to manually include j2ee.jar for compiling, here is the entire build.xml:
<?xml version="1.0"?>
<!--PRIMARY build file for all of dev modual -->
<project name="com" default="compile.all" basedir="../">
<path id="project.class.path">
<pathelement location="lib/"/>
<pathelement path="${java.class.path}/"/>
<pathelement path="${additional.path}"/>
<pathelement path="${CLASSPATH}" />
<pathelement path="${classpath}" />
</path>
<property name="SRCDIR" value="${basedir}/java" />
<property name="DSTDIR" value="${basedir}/classes" />
<property name="LIBDIR" value="${basedir}/libs" />
<property name="JARDIR" value="${basedir}/jars" />
<property name="DOCDIR" value="${basedir}/docs" />
<property name="ORACLE.JAR" value="${LIBDIR}/orcl/8.1.7/classes12.zip" />
<property name="JUNIT.JAR" value="${LIBDIR}/junit/3.7/junit.jar" />
<property name="CLASSPATH" value="z:/tools/java;${SRCDIR};${DSTDIR};${JUNIT.JAR};${ORACLE.JAR}" />
<property name="POLICYFILE" value="${SRCDIR}/com/leader/cti/main/ctimain.policy" />
<property name="DEBUG_FLAG" value="on" />
<property name="OPTIMIZE_FLAG" value="off" />
<property name="DEPRECATION_FLAG" value="off" />
<property name="RMI_VERSION" value="1.2" />
<!-- builds everything -->
<target name="compile.all">
<antcall target="compile.cti"/>
</target>
<target name="compile.vbsf" description="Compiles files for vbsf.jar.">
<mkdir dir="${DSTDIR}"/>
<copy file="${SRCDIR}/VBSFELK5UD3SWQ2E.class" todir="${DSTDIR}"/>
<javac srcdir="${SRCDIR}" destdir="${DSTDIR}" classpath="${CLASSPATH}" debug="${DEBUG_FLAG}" deprecation="${DEPRECATION_FLAG}" optimize="${OPTIMIZE_FLAG}" >
<include name="com/objectmatter/**/*.java" />
</javac>
</target>
<target name="compile.persist" description="Compiles files for persist.jar." depends="compile.vbsf" >
<javac srcdir="${SRCDIR}" destdir="${DSTDIR}" debug="${DEBUG_FLAG}" deprecation="${DEPRECATION_FLAG}" optimize="${OPTIMIZE_FLAG}" >
<classpath refid="project.class.path"/>
<include name="com/leader/persist/**/*.java" />
<include name="testcom/leader/persist/**/*.java" />
</javac>
</target>
<target name="compile.cti" description="Compiles files for both cti jars." depends="compile.persist,compile.cti.only" />
<target name="compile.cti.only" description="Compiles files for both cti jars." >
<javac srcdir="${SRCDIR}" destdir="${DSTDIR}" debug="${DEBUG_FLAG}" deprecation="${DEPRECATION_FLAG}" optimize="${OPTIMIZE_FLAG}" >
<classpath refid="project.class.path"/>
<include name="com/leader/cti/**/*.java" />
<include name="testcom/leader/cti/**/*.java" />
</javac>
<rmic classpath="${CLASSPATH}" base="${DSTDIR}" stubversion="${RMI_VERSION}" >
<include name="com/leader/cti/main/RMICTIService.class" />
<include name="com/leader/cti/main/RMIConferenceCall.class" />
<include name="com/leader/cti/main/RMIConferenceCallReservation.class" />
<include name="com/leader/cti/main/FakeRmiCtiService.class" />
<include name="com/leader/cti/main/FakeRmiConferenceCall.class" />
<!--include name="com/leader/cti/main/DerivedQueueReceiver.class"/-->
</rmic>
</target>
<!-- build all dev jars -->
<target name="jar.all"
description="Create all jar files"
depends="jar.vbsf, jar.persist, jar.jeti, jar.service"/>
<!-- build vbsf.jar -->
<target name="jar.vbsf"
description="Create client distribution jar for vbsf code"
depends="compile.vbsf" >
<mkdir dir="${JARDIR}" />
<jar jarfile="${JARDIR}/vbsf.jar"
basedir="${DSTDIR}" >
<include name="VBSFELK5UD3SWQ2E.class"/>
<include name="com/objectmatter/**/*.class" />
</jar>
</target>
<!-- build persist.jar -->
<target name="jar.persist"
description="Create client distribution jar"
depends="compile.vbsf,compile.persist" >
<mkdir dir="${JARDIR}" />
<jar jarfile="${JARDIR}/persist.jar"
basedir="${DSTDIR}" >
<include name="com/leader/persist/**/*.class" />
</jar>
</target>
<!-- build jeti.jar -->
<target name="jar.jeti"
description="Create client distribution jar"
depends="compile.vbsf,compile.persist,compile.cti" >
<mkdir dir="${JARDIR}" />
<jar jarfile="${JARDIR}/jeti.jar"
basedir="${DSTDIR}" >
<include name="com/leader/cti/rmiint/*" />
<include name="com/leader/cti/main/*Stub*" />
<include name="com/leader/cti/util/**" />
<include name="com/leader/cti/vru/*" />
<include name="com/leader/cti/interfaces/*" />
<include name="com/leader/cti/history/*" />
<include name="com/leader/cti/autodial/*" />
</jar>
</target>
<!-- build jeti_service.jar -->
<target name="jar.service"
description="Create the jar file for the service"
depends="compile.vbsf,compile.persist,compile.cti" >
<mkdir dir="${JARDIR}" />
<copy file="${basedir}/vbsf/cti.schema" tofile="${DSTDIR}/cti.schema" />
<copy file="${basedir}/vbsf/cti.schema" tofile="/tools/java/com/leader/osapplication/persist/cti.schema" />
<jar jarfile="${JARDIR}/jeti_service.jar"
basedir="${DSTDIR}" >
<include name="com/leader/cti/**" />
<include name="cti.schema" />
</jar>
</target>
<!-- build jeti.jar, jeti_service.jar -->
<target name="jar.cti"
description ="Create client/server jars for cti"
depends="jar.jeti,jar.service" />
<!-- clean everything. -->
<target name="clean">
<delete dir="${DSTDIR}" />
<delete dir="${JARDIR}" />
<delete dir="${DOCDIR}" />
</target>
<target name="clean.cti" description="clean cti class files (not jars)">
<delete dir="${DSTDIR}/com/leader/cti" />
<delete dir="${DSTDIR}/testcom/leader/cti" />
</target>
<!-- Run the gui CTI tests -->
<target name="test_cti_gui">
<java classname="junit.swingui.TestRunner" classpath="${CLASSPATH}" fork="yes">
<arg value="testcom.leader.cti.CTIPackageTest"/>
<sysproperty key="leader.unique_number_generator.file" value="unique_number_generator_file_test" />
<sysproperty key="vbsf.repository" value="/tools/java/dev/vbsf" />
<sysproperty key="vbsf.enableGlobalCaching" value="false" />
</java>
</target>
<target name="test.cti.gui"
depends="test_cti_gui" />
<!-- Run the text version of CTI tests -->
<target name="test">
<java classname="junit.textui.TestRunner" classpath="${CLASSPATH}" fork="yes">
<arg value="testcom.leader.cti.CTIPackageTest"/>
<sysproperty key="leader.unique_number_generator.file" value="unique_number_generator_file_test" />
</java>
</target>
<!-- Run CTI service -->
<target name="run.service"
description="run the service normally"
depends="compile.all" >
<java classname="com.leader.cti.main.CTIMain"
classpath="${CLASSPATH}"
fork="yes" >
<sysproperty key="java.security.policy"
file="${POLICYFILE}" />
<sysproperty key="config.dir"
value="${SRCDIR}/com/leader/cti/main/" />
</java>
</target>
<!-- Run fake CTI service -->
<target name="run.service.fake"
description="run the fake service"
depends="compile.all" >
<java classname="com.leader.cti.main.FakeCtiMain"
classpath="${CLASSPATH}"
fork="yes" >
<sysproperty key="java.security.policy"
file="${POLICYFILE}" />
<sysproperty key="config.dir"
value="${SRCDIR}/com/leader/cti/main/" />
</java>
</target>
<!-- Run CTI service emulator -->
<target name="run.service.emulator"
description="run the service normally"
depends="compile.all" >
<java classname="com.leader.cti.main.CTIMain"
classpath="${CLASSPATH}"
fork="yes" >
<sysproperty key="java.security.policy"
file="${POLICYFILE}" />
<sysproperty key="config.dir"
value="${SRCDIR}/com/leader/cti/main/" />
<sysproperty key="vru.propertyfile"
value="emulator.properties" />
</java>
</target>
<!-- Runs the CTI service and emulator -->
<target name="run.emulator"
description="run the service and the emulator"
depends="compile.all" >
<java classname="testcom.leader.cti.vru.emulator.VRUEmulator"
classpath="${CLASSPATH}"
fork="yes" />
</target>
<!-- Runs the gui CONCALL testss -->
<target name="run.gui"
description="run the concall test gui"
depends="compile.all" >
<java classname="testcom.leader.cti.main.SwingClient"
classpath="${CLASSPATH}"
fork="yes" >
<sysproperty key="java.security.policy"
file="${POLICYFILE}" />
</java>
</target>
<!-- Fires the maptool up. Defaults to CTI`s Schema file. -->
<target name="maptool" >
<java classname="com.objectmatter.bsf.mapping.toolgui.MapTool"
fork="yes"
classpath="${CLASSPATH}" >
<sysproperty key="vbsf.repository" value="${basedir}/vbsf" />
</java>
</target>
<target name="javadoc_cti">
<mkdir dir="${basedir}/docs"/>
<javadoc packagenames="com.leader.*" classpath="${CLASSPATH}" sourcepath="${SRCDIR}" destdir="${DOCDIR}\cti" author="true" version="true" use="true" windowtitle="Leader CTI API" doctitle="Leader Technologies, Inc" bottom="Copyright © 2005 Leader Technologies Incorporated.<BR>All Rights Reserved." maxmemory="128m">
<group title="Leader CTI Packages" packages="com.leader*"/>
</javadoc>
</target>
<target name="javadoc_vbsf">
<mkdir dir="${basedir}/docs"/>
<javadoc packagenames="com.objectmatter.* " classpath="${CLASSPATH}" sourcepath="${SRCDIR}" destdir="${DOCDIR}" author="true" version="true" use="true" windowtitle="VBSF by ObjectMatter API" doctitle="Leader Technologie, Inc" bottom="Copyright © 2005 Leader Technologies Incorporated.<BR>All Rights Reserved." maxmemory="128m">
<group title="Objectivity Packages" packages="com.objectmatter.*"/>
</javadoc>
</target>
</project>
i am getting this:
compile.all:
compile.vbsf:
compile.persist:
compile.cti.only:
Compiling 1 source file to C:\Projects\Leader\dev\classes
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:14: package javax.jms does not exist
import javax.jms.*;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:17: package javax.jms does not exist
import javax.jms.Queue;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:18: package javax.jms does not exist
import javax.jms.JMSException;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:19: package javax.jms does not exist
import javax.jms.Message;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:28: cannot find symbol
symbol: class MessageListener
public abstract class BasicMQReceiverAsyncR implements Runnable, MessageListener
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:44: cannot find symbol
symbol : class QueueConnectionFactory
location: class BasicMQReceiverAsyncR
QueueConnectionFactory queueConnectionFactory = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:45: cannot find symbol
symbol : class QueueConnection
location: class BasicMQReceiverAsyncR
QueueConnection queueConnection = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:46: cannot find symbol
symbol : class QueueSession
location: class BasicMQReceiverAsyncR
QueueSession queueSession = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:48: cannot find symbol
symbol : class QueueReceiver
location: class BasicMQReceiverAsyncR
QueueReceiver queueReceiver = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:49: cannot find symbol
symbol : class TextMessage
location: class BasicMQReceiverAsyncR
TextMessage message = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:406: cannot find symbol
symbol : class QueueConnectionFactory
location: class BasicMQReceiverAsyncR
queueConnectionFactory = (QueueConnectionFactory)
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:408: package javax.jms does not exist
queue = (javax.jms.Queue) jndiContext.lookup(QUEUE_NAME); //queue1 = (javax.jms.Queue)jndiContext.lookup("MyQueue1");
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:433: cannot find symbol
symbol : variable Session
location: class BasicMQReceiverAsyncR
Session.AUTO_ACKNOWLEDGE);
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:447: cannot find symbol
symbol : class JMSException
location: class BasicMQReceiverAsyncR
catch (JMSException e)
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:461: cannot find symbol
symbol : class JMSException
location: class BasicMQReceiverAsyncR
catch (JMSException x)
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:482: cannot find symbol
symbol : class BytesMessage
location: class BasicMQReceiverAsyncR
if (m instanceof BytesMessage)
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:488: cannot find symbol
symbol : class BytesMessage
location: class BasicMQReceiverAsyncR
BytesMessage bytesMsg = (BytesMessage)m;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:488: cannot find symbol
symbol : class BytesMessage
location: class BasicMQReceiverAsyncR
BytesMessage bytesMsg = (BytesMessage)m;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:501: cannot find symbol
symbol : class QueueSession
location: class BasicMQReceiverAsyncR
QueueSession queueSession2 = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:502: cannot find symbol
symbol : class QueueSender
location: class BasicMQReceiverAsyncR
QueueSender queueSender2 = null;
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:510: cannot find symbol
symbol : variable Session
location: class BasicMQReceiverAsyncR
Session.AUTO_ACKNOWLEDGE);
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:514: cannot find symbol
symbol : class BytesMessage
location: class BasicMQReceiverAsyncR
BytesMessage bytesMessage = queueSession.createBytesMessage();
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:523: cannot find symbol
symbol : variable DeliveryMode
location: class BasicMQReceiverAsyncR
DeliveryMode.PERSISTENT,
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:524: cannot find symbol
symbol : variable DEFAULT_PRIORITY
location: class com.leader.cti.vru.Message
Message.DEFAULT_PRIORITY,
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:525: cannot find symbol
symbol : variable DEFAULT_TIME_TO_LIVE
location: class com.leader.cti.vru.Message
Message.DEFAULT_TIME_TO_LIVE);
C:\Projects\Leader\dev\java\com\leader\cti\msgqueue\BasicMQReceiverAsyncR.java:529: cannot find symbol
symbol : class JMSException
location: class BasicMQReceiverAsyncR
catch (JMSException x)
26 errors
C:\Projects\Leader\dev\java\build.xml:34: The following error occurred while executing this line:
C:\Projects\Leader\dev\java\build.xml:56: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 8 seconds)
my class path is:
.;C:\Projects\Leader\prototype\jms\build\classes;C:\Projects\Leader\dev\libs\persist.jar;C:\Projects\Leader\dev\classes;%OPENJMS_HOME%\lib;%OPENJMS_HOME%\lib\antlr-2.7.2.jar;%OPENJMS_HOME%\lib\castor-0.9.5.jar;%OPENJMS_HOME%\lib\commons-codec-1.3.jar;%OPENJMS_HOME%\lib\commons-collections-2.1.jar;%OPENJMS_HOME%\lib\commons-dbcp-1.2.1.jar;%OPENJMS_HOME%\lib\commons-logging-1.0.4.jar;%OPENJMS_HOME%\lib\commons-pool-1.2.jar;%OPENJMS_HOME%\lib\concurrent-1.3.4.jar;%OPENJMS_HOME%\lib\derby-10.1.1.0.jar;%OPENJMS_HOME%\lib\jdbc-2.0.jar;%OPENJMS_HOME%\lib\jms-1.1.jar;%OPENJMS_HOME%\lib\jndi-1.2.1.jar;%OPENJMS_HOME%\lib\jta-1.0.1.jar;%OPENJMS_HOME%\lib\log4j-1.2.11.jar;%OPENJMS_HOME%\lib\openjms-0.7.7-beta-1.jar;%OPENJMS_HOME%\lib\openjms-common-0.7.7-beta-1.jar;%OPENJMS_HOME%\lib\openjms-net-0.7.7-beta-1.jar;%OPENJMS_HOME%\lib\openjms-tools-0.7.7-beta-1.jar;%OPENJMS_HOME%\lib\oro-2.0.8.jar;%OPENJMS_HOME%\lib\spice-jndikit-1.2.jar;%OPENJMS_HOME%\lib\xerces-2.4.0.jar;%OPENJMS_HOME%\lib\xml-apis-1.0.b2.jar;%J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib
as you can see j2ee.jar is in %J2EE_HOME%\lib, but still doesn't work. can someone help me?<property name="messaging.client.jar.path" value="Location in your local drive" />
<property name="messaging.client.jar.name" value="nameOfYourFile.jar" /> -
Include an in-memory jar file for JSR-199 compilation
I want to compile a source file in memory, which requires a jar file that is also represented in memory. I used the JavaSourceFromString class recommended in the documentation for the class JavaCompiler and in a demo I found online that shows how to compile sources represented as String in memory. To represent the jar file, I used a similar trick to JavaSourceFromString:
public class JarJavaFileObjectFromByteArray extends SimpleJavaFileObject {
* The contents of this jar file.
private final byte[] contents;
* Constructs a new JarJavaFileObjectFromByteArray given the name and binary
* contents of a jar file.
* @param name the name of this jar file
* @param contents the contents of this jar file
public JarJavaFileObjectFromByteArray(String name, byte[] contents) {
super(newURI(name), Kind.OTHER);
this.contents = contents;
... // code not shown ensures that the URI returned from newURI is of the form,
// for instance, bytes:///MathConstants.jar, if the name of the jar file is MathConstants.jar
@Override
public InputStream openInputStream() throws IOException {
return new ByteArrayInputStream(contents);
}However, I do not know how to alert the compiler that this jar file should be on the classpath. I tried this:
List<String> options = Arrays.asList(" -classpath bytes:///MathConstants.jar ");
CompilationTask task = compiler.getTask(null, fileManager, null, options, null, compilationUnits);but I get the following error when calling getTask:
java.lang.IllegalArgumentException: invalid flag: -classpath bytes:///MathConstants.jarI assume there is some way to tell the compiler, "look at the MathConstants.jar file that I am storing in memory when searching the classpath", but I do not know how to do this. I assumed that the options parameter for getTask represents command-line flags that would be passed to the compiler if this were happening on the command line (such as "-cp .", which also does not work), but perhaps this assumption is wrong.Hi Bruce,
I have a question regarding loading a jar file by the compiler to dynamically compile with a source file. I hope you can probably offer me an idea on what has been missing or wrong with the source codes I have written for my application.
I am using Eclipse compiler to dynamically compile a class. In the class, I want it to make a reference to a jar file for compilation dynamically.
Here is the source of a test class I wrote:
import javax.servlet.http.HttpServlet;
class MyServlet extends HttpServlet {
}The import statement refers to the class javax.servlet.http.HttpServlet from the jar file C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\servlet-api.jar placed in the file system.
In the method called compileClass (shown below), I used the path of the jar file to add to the option -classpath as you suggested.
private static CompileClassResult compileClass(Writer out, String className, String classSource) {
try {
JavaCompiler javac = new EclipseCompiler();
StandardJavaFileManager sjfm = javac.getStandardFileManager(null, null, null);
SpecialClassLoader scl = new SpecialClassLoader();
SpecialJavaFileManager fileManager = new SpecialJavaFileManager(sjfm, scl);
List<String> options = new ArrayList<String>();
options.addAll(Arrays.asList("-classpath", "C:\\Program Files\\Apache Software Foundation\\Tomcat 6.0\\lib\\servlet-api.jar"));
List<MemorySource> compilationUnits = Arrays.asList(new MemorySource(className, classSource));
DiagnosticListener<JavaFileObject> diagnosticListener = null;
Iterable<String> classes = null;
if (out == null) {
out = new PrintWriter(System.err);
JavaCompiler.CompilationTask compile = javac.getTask(out, fileManager, diagnosticListener, options, classes, compilationUnits);
boolean res = compile.call();
if (res) {
//Need to modify the api to return an array of two elements - one classes and other bytecodes for all classes in the same class file.
return CompileClassResult.newInstance(scl.findClasses(), scl.findByteCodes());
} catch (Exception e) {
e.printStackTrace();
return null;
}I also extended the class ForwardingJavaFileManager as you suggested and have it delegated to the StandardJavaFileManager sent to the compiler mentioned in the method compileClass above. The extended class (called SpecialJavaFileManager) is as follows:
public class SpecialJavaFileManager extends ForwardingJavaFileManager<StandardJavaFileManager> {
private SpecialClassLoader xcl;
public SpecialJavaFileManager(StandardJavaFileManager sjfm, SpecialClassLoader xcl) {
super(sjfm);
System.out.println("SpecialJavaFileManager");
this.xcl = xcl;
public JavaFileObject getJavaFileForOutput(Location location, String name, JavaFileObject.Kind kind, FileObject sibling) throws IOException {
System.out.println("getJavaFileForOutput");
MemoryByteCode mbc = new MemoryByteCode(name);
xcl.addClass(name, mbc);
return mbc;
public Iterable<JavaFileObject> list(JavaFileManager.Location loc, String pkg, Set kinds, boolean recurse) throws IOException {
System.out.println("list ");
List<JavaFileObject> result = new ArrayList<JavaFileObject>();
for (JavaFileObject f : super.list(loc, pkg, kinds, recurse)) {
System.out.println(f);
result.add(f);
return result;
}I run the application and the result shows that it didn't load the jar file into the memory as expected. From the output (below) I got, it doesn't seem to invoke the method list(...) in the class SpecialJavaFileManager.
SpecialJavaFileManager
1. ERROR in \MyServlet.java (at line 1)
import javax.servlet.http.*;
^^^^^^^^^^^^^
The import javax.servlet cannot be resolved
2. ERROR in \MyServlet.java (at line 3)
class MyServlet extends HttpServlet {
^^^^^^^^^^^
HttpServlet cannot be resolved to a typeWould you please let me know what has possibly be missing or wrong?
Thanks.
Jonathan
Edited by: jonathanlam on Aug 10, 2009 6:47 PM
Maybe you are looking for
-
Hi friends, I am working on ABAP Proxies in XI(Client Proxy) After creating the Message interface in Integration Repository , I went to the ABAP proxy generation,using SPROXY. And went to he Message Interface (Outbound) .There its displaying "Proxy_i
-
Javax.transaction.SystemException: Exceeded maximum allowed transactions on
Hi, I receive the following error when restarting weblogic server instance. Same error occurs when re-deploying the package. I had previously deployed this package OK. Nothing has changed for the jar file it is complaining about. I have restarted all
-
Any more support beyond jdk1.3.1_13 branch?
Since one of our products still uses the jdk1.3.1_X branch, we wonder how long Sun will continue to support this branch beyond 1.3.1_13 in term of bug fix or functionality added before it forces everyone to switch to 1.4.x? Does anyone know? Thanks,
-
I upgraded my ipad3 to 8.1.1 and now I can't turn the pages in my library ebook
I upgraded my ipad3 to 8.1.1 and now I can't turn the pages in my library ebook. Books in iBooks work.
-
ITunes Taskbar Buttons: No Functionality
I have the latest version of iTunes. When recently updating, I've lost the functionality of my taskbar buttons. I've tried Googling for solutions, and none have worked. I haven't tried reinstalling iTunes, but from what I've seen that hasn't worked f