URLClassLoader - with JAR Files- - - Please Help
Hi all,
I have two seperate JAR files which contain same files but different progressive versions.JAR 1 is version V1 and JAR 2 is Version V1.1
I have a program which loads classes from these two JARS and runs certain comparsions on them.CODE IS SHOWN and SO is ERROR.PLEASE HELP and ADVISE.Im on a UNix box using JDK 1.3.
CODE:
====
1.In my main i define the TWO JARS PATHS and the item to compare called ENTITYNAME as:
String jarFile1 = "/xenv/GFINet_Java/6.2_Z1/1.3.X/gfinet_entities.jar";
String jarFile2 = "/xenv/GFINet_Java/6.1_Y1/1.3.X/gfinet_entities.jar";
String entityName = "gfinet.entities.GFIBasketEntity";
2.Then i call the function
EntityVersionComparator evc = new EntityVersionComparator();
evc.test(jarFile1, jarFile2, entityName);
3.Test function loads the JARS
private void test(String jarFile1, String jarFile2, String entityName) throws Exception {
URLClassLoader jar1 =
(URLClassLoader)newClassLoader(jarFile1);
URLClassLoader jar2 =
(URLClassLoader)newClassLoader(jarFile2);
4. Load that item ENTITYNAME FROM JAR.
// load GFIBasketEntity from Jar1
GFIBaseEntity ent1 =
(GFIBaseEntity)loadClass(jar1, entityName).newInstance();
PROBLEM ERRORS:
==============
Exception in thread "main" java.net.MalformedURLException : no
protocol :/xenv/GFINet_Java/sun4/6.2.Z2/Solaris8/3.3.2/1.3.X/lib/gfinet_entities.jar
at java.net.URL.<init>(URL.java:473)
at java.net.URL.<init>(URL.java:376)
at java.net.URL.<init>(URL.java:330)
at EntityVersionComparator.newClassLoader(EntityVersionComparator.java:143)
at EntityVersionComparator.test(EntityVersionComparator.java:88)
at EntityVersionComparator.main(EntityVersionComparator.java:74)
WHATS GOING ON..Is there something wrong with the path?Pls advise
jason
I also in my CODE have:
private ClassLoader newClassLoader(String path)
throws MalformedURLException
{ URL url = new URL(path);
return new URLClassLoader(new URL[]url);
Similar Messages
-
I am new with JAR files please help me
Hi Dear All,
I am new with JAR files, I know concept, but dont know how to careate JAR, and how do i use it?
Please help me.
ThanksThis tutorial covers that:
http://java.sun.com/docs/books/tutorial/deployment/jar/index.html -
Problem with jar file please help!!
Hi everybody
I make a jar file using Jbuilder;my application interact with oracle and when i try to run it ,I get the following message:
"no driver was found "
however i add the oracle driver in my jar file as a library dependencies.
could some one helpI don't know whether this will help you or not.
You have mentioned that drivers are added into jar file which you have created. Similar situation I faced. In my case I added classes12.zip for ORACLE thin drivers. For this to work I had to set classpath for this zip file. Once I set the classpath for this zip file my application started working fine.
So if you are using any zip or jar file for your driver you will have to define it in your classpath.
Mushy -
Executabe Jar File: Please Help
Here is the problem. I had no problem before creating and running executable jar files at work or at home. I write the manifest file and then run "jar cmf mymanifestfile jarfile.jar *.class" and everything is fine. Both my work and home computer were set up to execute jar files, so all I had to do was click on the option.
Now here is the problem. At work, they just installed PKZIP and now that is default for opening jar files. I still want it to execute the jar file though, so last night, when I went home, I right clicked on a jar file I had, clicked on properties, and saw that where it said "Open With" I had javaw. Sooo.. today, I come back to work, right click on a jar file here, and then where it says "Open With" I change it to "javaw" but now when I click on the file, it gives me a Java Virtual Machine error saying it can not find the main file. I am positive that this jar file was created correctly. Furthermore, if I go to the DOS prompt and run it using "java -jar jarFile.jar" it runs just fine (If I do "javaw jarFile.jar", it does NOT work).
So my question is this: what do I need to set the "Open With" program to for executing jar files. Is there a way to do command line parameters so I can open with "java -jar". Please help.
Any help would be very appreciated.Also, another thing that is weird is this.
The old jar files that I created at home, run fine at home (execute when I double click them), and if you look at the properties they are run with "javaw", but, the new jar files I create, that I create exactly the same way as the ones I created before, dont work when I double click them. -
Good day all.
I am very new to java and admittedly not a very technologically savvy person. However, I play the card game "Magic: The Gathering"? and wish to play online because not any of my friends play. I use a macintosh computer. I researched Magic Online and found you could download a free trial from Wizards of the Coast Website, but it was not for Macs. I continued to research and found something called "WebWizard" a program allowing Mac users to play Magic Online. I downloaded the necessary files and attempted to install them. The two files were named 'ww.jar' and 'cards.jar'. When I opened 'ww.jar' it said "Jar Launcher: The jar file "ww.jar" couldn't be launched. Check the Console for possible error messages". I opened 'cards.jar' and received the same message. Using what little intelligence I have in regard to Java, I opened a search for anything related to it, and found the Java Web Start application. I started up the application and followed the instructions, and was asked to locate the files I wanted to view. I located the first, 'ww.jar', and it opened a page full of what I assume was programming language that had been translated into what the symbols would be on my computer - Total gibberish. I opened the 'ww.jar' once again and the error message did not appear. Instead, the WebWizard window started up!
However, I needed to get the 'cards.jar' file to work so I could start playing Magic Online. I tried to do the same thing with Java Web Start, but 'cards.jar' failed to open when I located it. I tried opening the file anyways, but nothing happened.
I have worked for about an hour on trying to get this to work, and have not found any way. Please help me out!If you just want to play casually, you can use Magic Workstation. It's free, but it won't let you play with other people on Magic Online, but I think it does have some tournaments of its own (but not for prizes). Another older piece of software that isn't used as much anymore is Apprentice. I don't know if either of these run on a Mac.
Depending on what version of Mac you're using (and if you have a PowerPC processor), you might be able to use Virtual PC (which costs money) to install a Windows image on your computer, and then virtually run Magic Online (if you obtain the Windows image from a file sharing network instead of purchasing Windows legitimately, this is illegal).
You could also try using VMware Player (which is free software) to run Windows virtually on your computer and play Magic Online that way. I'm not sure if VMware runs on a Mac though.
Please don't try all of these things until something works; this will be very time consuming. Give us some more background on where the Jar files came from and, if you can, the error messages printed to the Java console. Also, how much do you know about computers? If you know how to compile source code that will probably increase your options since I believe the source code for VMWare Player is available. -
Images in jar file, Please help!!
Hello,
This is my code, I am trying to add images to buttons in ToolBar. The code along with images works if I say "java ABC", but dont work(images dont appear) when I jar the files. I have tried all the possible methods, Please help me.
new2 = new JButton(new ImageIcon("images/new.gif"));
/*try{
ClassLoader loader=getClass().getClassLoader();
URL fileLocation=loader.getResource("./images/new.gif");
Image img=Toolkit.getDefaultToolkit().getImage(fileLocation);
new2 = new JButton(new ImageIcon(img));
}catch(Exception e) { e.printStackTrace(); }*/
//new2 = new JButton(new ImageIcon(ClassLoader.getSystemResource("images/new.gif")));
//new2 = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().getImage(getClass().getResource("./images/new.gif"))));
//ImageIcon oo = new ImageIcon();
//new2 = new JButton(oo.setImage(getClass().getResource("images/new.gif")));
new2.setToolTipText("New");
Thanks
JamesHello,
The code is too big to post, I am adding the code that is required to get changed, please see it
open2 = new JButton(new ImageIcon("images/open.gif"));
open2.setToolTipText("Open");
open2.addActionListener(this);
open2.addMouseListener(new MouseAdapter()
public void mouseEntered(MouseEvent me)
status.setText("Opens a file");
public void mouseExited(MouseEvent me)
status.setText("open");
Thanks
James -
Hello,
suppose I have three .jar files: file1.jar, file2.jar and file3.jar.
these file are in the folder c:\folder.
how can i specify all this files in my classpath without specifying them one by one. now i'm doing it like:
classpath=c\folder\file1.jar;c:\folder\file2.jar;c:\folder\file3.jar
I will like to do this at once
can someone help me please?
thanks.If u mean that u want only one jar file must be added to classpath, then extract file1.jar, file2.jar and file3.jar to some path (say myFolder). Then, zip the contents of myFolder (don't zip myfolder as well!) into one jar file (zip creates a .zip file - rename it as a .jar file). So, u have one jar file with the contents of 3 jar files. But I seriously don't see why u want to do this. The semicolon terminated way of adding jars would work just as well right?
-
Executable Jar file, please help!!!
I know this has been posted many times before, but Im going insane, and nothing is working, I will now have spent more time trying to make an executable jar file, than the time I spent actually writing the program, here's my problem
I got two classes, tictactoe.class, and whichBox.class, I want to make a jar file, I have tried many types of manifest files, none worked, my Main() is in tictactoe.class, if ANYONE can help me get this working I will give them dukes!!!!!I know this has been posted many times before, but Im
going insane, and nothing is working, I will now have
spent more time trying to make an executable jar file,
than the time I spent actually writing the program,
here's my problem
I got two classes, tictactoe.class, and
whichBox.class, I want to make a jar file, I have
tried many types of manifest files, none worked, my
Main() is in tictactoe.class, if ANYONE can help me
get this working I will give them dukes!!!!!
your manifest file should look like this...
Manifest-Version: 1.0
Main-Class: tictactoeplease note there must be a line return at the end of tictactoe. so the file should have three lines.
if you have this correct the only other thing i can suggest is are you sure it is your manifest file that is being added to the jar.
your jar command should look like the following assuming the jar files is called Game, your manifest is called game.mf and both files reside in the default package.
jar -cvfm Game.jar game.mf *.class hope this helps. -
Read parameter error -50 with larger file - please help
I have this line of code: (read sfRef from SourcePosition as data)
It works fine with these 811.2MB files but when I try to read from a 1.62GB file I get parameter error -50. Did I miss something about larger files?found it!
You can't read larger than 1gb. I had it grab the data in multiple pieces and it works now. -
I have a jar file named Helper.jar with
com.xyz.util.Helper.class in it.
Now I have a SrcFile.java that
imports com.xyz.util.Helper;
It compiles fine with:
java -classpath Helper.jar;. SrcFile.java
...and runs fine with:
java -cp Helper.jar;. SrcFile
When I jar it with:
jar cvfm SrcFile.jar SrcFile.mf *.class
...and run it with:
java -cp Helper.jar;. -jar SrcFile.jar
I get the following exception:
java.lang.NoClassDefFoundError: com/xyz/util/Helper
...but yet, Helpler.jar runs fine with:
java -jar Helper.jar
Does anyone have any idea what I am doing wrong or
do I have to un-jar the Helper.jar file and
re-jar SrcFile.jar with all the .class files?I've replied to this same thread in the New To Java Technology fourm, see there for a suggestion.
-
i can't read in Mavericks DVDs and Bluray data burn with UDF system files burn with Snow Leopard, please help me. Thanks
They are DVDs with video files from a little more than 2 GB per file, were burned in Snow Leopard, with UDF file system, now that I updated to Mavericks when I try to read disks displays the directory in the finder a moment and then disappear and does not display them show them more. It is impossible to read the discs, but only those who were burned with UDF file system. Thank you for your help.
-
I would like to open a pdf file. My MacPro ( Yosemite 10.10.2) is trying to open it with Numbers. I would like to open it with Pages. Please help! How do I open this .pdf with Pages? Thanks
Pages will not open a PDF file
It will export a file as PDF
See
Pages: Supported file formats - Apple Support -
HOW TO - Create new from clipboard and process multiple files - please help
Need help - have new version of photoshop on trial only ATM...
Want to know - HOW TO:
1. Create new from clipbaord
2. Process multiple files
Please help.For clipboard copy, I start with File > New and the size will be set to what's in the clipboard. Then once the new file is opened, Edit > Paste will place the clipboard contents as a layer in the new document.
You must remember to use the command Layer > Flatten Image of you want to save as jpeg or any other file format that doesn't support layers.
For processing multiple files,
File > Automate > Batch or
File > Scripts > Image Processor...
Check the User guide or google information for those commands if you have specific needs.
Gene -
Illustrator CS4 wont save files, please help?
You can edit a file, go to save, close it down, then when you re-open it the changes made have not been saved?? No error message or warning pops up, and it all looks ok like it has saved properly, until you open it up again. This also happens when you use 'save as' command if you use the original file name. If however you type in a different file name - it saves ok. But obviously that is not great as you cant now trust or rely on the save mechanism of the programme, to make sure any changes to artwork have been stored!! I have never seen an issue like this, it is worrying, I hope somebody can help?
Thanks.
We are running CS4 on windows7 - yes PC!!!We save in EPS, and its not just one file, its a variety of different files and it seems to be random as to which files it does it on, some work fine - some don't. And it can be anything from a minor text change to a colour change, it doesnt seem to matter on the change made, it reacts the same.
The files are saved over a network connection to a large external hard drive.
Its really puzzling and now starting to cause problems as we do a fair bit of work in it, and can't trust one of the most important features, and that any changes that have been done have been saved and stored!
Hope maybe you can help with any thoughts at all.
Cheers.
Date: Thu, 24 Jun 2010 03:41:40 -0600
From: [email protected]
To: [email protected]
Subject: Illustrator CS4 wont save files, please help?
What file format do you save it in?
What kinds of changes did you make in that file?
Where do you save the file (removable or network media)?
> -
my ipod generation 5 will not come out of recovery mode. i was simply updating my software and this happened. it will not let me restore it comes up with and error. please help, thanks.
Hey erinoneill24,
Thanks for using Apple Support Communities.
Sounds like you can't update your device. You don't mention an error that it gives you. Take a look at both of these articles to troubleshoot.
iPod displays "Use iTunes to restore" message
http://support.apple.com/kb/ts1441?viewlocale=it_it
If you can't update or restore your iOS device
http://support.apple.com/kb/HT1808?viewlocale=de_DE_1
If you started your device in recovery mode by mistake, restart it to exit recovery mode. Or you can just wait—after 15 minutes the device will exit recovery mode by itself.
Have a nice day,
Mario
Maybe you are looking for
-
Can't get into my DE anymore after nvidia/nouveau switch + other stuff
I made a mess of things, and I'd very much like to get my system back into a normal state. Here's a brief history of important events: (1) About 2 weeks ago after a system update, I couldn't log into Gnome via GDM anymore (see topic). Thankfully I co
-
Thief is still on my apple account, can I do anything to track him?
Hi guys, I know there have been many existing discussions about retrieval of stolen ipads, but I'm one of the unfortunate ones who did not on Find My iPad (or it was turned off). However, after searching online, I found that photo stream is a method.
-
Sharing of MS Office Documents in Sharepoint 2010 using Desktop Apps Not Consistent
We have a Powerpoint File in Sharepoint 2010 that can be simultaneously edited by multiple users using the Desktop App. I thought this functionality was only available with the Web App? Does anyone know how this was enabled? I would like to make
-
HT1338 Why does mountain lion make my computer run slow and my Safari too?
why does Mountain Lion make my computer run slow and my Safari too? Please help!
-
Remove Photo Date Stamp?
I'm using a Nikon CoolPix 7900 travel camera. I just returned from Europe with about 1,000 photos on SD cards for this camera. When I download the photos using PS Elements 2.0 every photo has a Date & Time stamp on it. I don't know how or why this ha