Programming :: Replacing The File In .Jar - Java.lang.NoClassDefFoundError Exception At Main Class
Jul 21, 2010
working on a script to update .Jar file, I have tried jar xf to unpack and jar cf to repack it is giving me java.lang.NoClassDefFoundError exception at main class. I also tried jar uf, which is also not working for me Basically my jar file requires to update date, which i do from "winrar" Manual it works fine, but now to remove "Donkey work", i want to make an script which does this all automatically, and the last stage is to update jar file which is not happening.
Code: Select all import java.util.*; public class FindDupes { public static void main(String[] args) {   Set<String> orig = new HashSet<String>();   Set<String> dupe = new HashSet<String>();   for(String a: args)   if(!orig.add(a))     dupe.add(a);
  orig.removeAll(dupe);   System.out.println("words " + orig);   System.out.println("dudes " + dupe); } }
for some reason it will compile but not run on debian lenny complains it can't find the main class but it compiles and runs without problem on Fedora 12.
I'm writing a binary search tree class to insert records and I'm stuck on the following error:
Code: /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: ld returned 1 exit status Here is the code for my class:
[Code]...
I really don't know how to approach this, I thought that everything was working fine but I have no idea what is wrong. Also, for clarification, main() is in a different .cpp file that #includes "tree.h"
I've had to do some code in java, a language I'm very much unfamiliarly with so please excuse my incorrect use of terms. The basic outline of my problem is I create a class object as a local within a swing button function it works fine. If I create it as a global ( with I think I need to do ) within main, then prototype it with the other swing objects at the bottom of the file when it is called it causes a host of problems. I think the easiest way is to show it.
I am looking to write a function to return an MD5 hash in Java but I don't want to us the MessageDigest class as I am using the J2ME framework which doesn't include it.
I'm a noob linux user who thought it'd be pretty sweet to take an intro to programming prerequisite course for a master's program on a linux based system. Made sense at the time, use on operating system based on the premise that you'll be using the command line frequently to take a course where you'll be running your programs from the command line. Around the end of week two, and I started having some serious issues w/ my programs. Basically, any program that has to do any type of calculation (rather than just print string values I set initially for their respective variables), I get two intermittant errors.
Exception in thread "main" java.lang.NumberFormatException: invalid character at position 1 in uninitializedValue at java.lang.Integer.parseInt(libgcj.so.10) at java.lang.Integer.parseInt(libgcj.so.10) at CollegeAdmission.main(CollegeAdmission.java:21) icetherapy@Frodo:~/Documents/intro_prog/smith_Ch3$
The error is so intermittant I can't actually tell you what criteria to provide to get it. Numbers under 50 seem to trigger it more often though. I'll post the actual java code for that particular file in a second post. There is a second error I haven't been able to reproduce as a standard user tonight, but I got it to come up logged in as root:
Exception in thread "main" java.lang.NoClassDefFoundError: CollegeAdmission. at gnu.java.lang.MainThread.run(libgcj.so.10) Caused by: java.lang.ClassNotFoundException: CollegeAdmission. not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./,file:/home/icetherapy/Documents/intro_prog/smith_Ch3/],
CODE....
Things I've tried to do to fix it:
Entered the following into my .bashrc profile in an attempt to set the classpath. I spotted the JAVA_HOME bit in a thread and thought it worth a shot since I've been at this on and off for over two weeks with no success
# 5th attempt at adding CLASS_PATH to .bashrc profile export CLASSPATH=$CLASSPATH:~/Documents/intro_prog/smith_Ch3 JAVA_HOME=~/etc/java-6-sun export JAVA_HOME
Things I think I may have screwed up:
This is on Debian Squeeze, I went with a simple non-partitioned graphical install, and installed the JDK using they synaptic package manager. Normally, it looks like people have Java installed in their /bin directory, but mine ended up in /etc after the automated install
pwd returns: /etc/java
The class definition error makes me think that it's something to do with my CLASSPATH variable, but even when I set it in .bashrc to the directory the .class files are housed in, that error still returns. I feel like the integer parse error has something to do with not having installed everything, but I'm really just making that up, as I have no definitive proof.
I use Fedora 10.When I use Firefox , the following message appear with the dialog box.java.lang.SecurityException:Changing the SecurityManager is not allowed.:I click OK button.How can I do for it.
I have installed suse linux 11.3. I have jdk 1.6.20.0 and oracle 10g 10.2.0. When I tried to connect to a database through thin driver ,it is giving me the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: odata Caused by: java.lang.ClassNotFoundException: odata at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: odata. Program will exit.
I'm trying to math all class references in a C++ file using grep with regular expression. I'm trying to know if a specific include is usuless or not, so I have to know if there is a refence in cpp. I wrote this RE that searches for a reference from class ABCZ, but unfortunately it isn't working as I espected:
grep -E '^[^(/*)(//)].*[^a-zA-Z]ABCZ[]*[*(<:;,{& ]' ^[^(/*)(//)] don't math comments in the begging of the line ( // or /* ) .* followed by any character
[code]....
Well, I can get patterns like this:
class Test: public ABCZ{ class Test: public ABCZ { class Test : public ABCZ<T>
I want a internet browser to open a site that needs java engine,firefox has not this and also galeon :
The certificate is not trusted because it is self-signed.
(Error code: sec_error_ca_cert_invalid)
* This could be a problem with the server's configuration, or it could be someone trying to impersonate the server.
* If you have connected to this server successfully in the past, the error may be temporary, and you can try again later.
Or you can add an exception
You should not add an exception if you are using an internet connection that you do not trust completely or if you are not used to seeing a warning for this server.
If you still wish to add an exception for this site, you can do so in your advanced encryption settings.
How i can add exception or it is better to say me that :is there any browser instead of internet explorer for linux??
implementing hamming code in c: Calculating the Hamming Code The key to the Hamming Code is the use of extra parity bits to allow the identification of a single error. Create the code word as follows:
Mark all bit positions that are powers of two as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.) All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17, etc.)
I have Debian Testing, Kernel 2.6.32-trunk-686 and Java version: java version "1.6.0_16" Java(TM) SE Runtime Environment (build 1.6.0_16-b01) Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
If I open web page with Java application (in Opera, Iceweasel and Google Chrome), for example this page: [URL] I get error message (image in attachment). If I click in the Details, I get this text: Java Plug-in 1.6.0_16 Using JRE version 1.6.0_16-b01 Java HotSpot(TM) Server VM User home directory = /home/johnnycage c: clear console window f: finalize objects on finalization queue g: garbage collect h: display this help message l: dump classloader list m: print memory usage o: trigger logging q: hide console r: reload policy configuration s: dump system and deployment properties t: dump thread list v: dump thread stack x: clear classloader cache 0-5: set trace level to <n>
load: class AppletGui not found. java.lang.ClassNotFoundException: AppletGui ..... Exception: java.lang.ClassNotFoundException: AppletGui
I doing malloc and getting the chunk of dynamic memory. Now I want it to align that memory to 64KB. This means that the address of the memory starts from 64KB or multiple of 64KB.
I browse with Firefox and I had been running a pretty vanilla install of Ubuntu 10.4 (with a few things like tomcat and mysql) I supposed the repos kept everything (like java) up to date.
Some time ago I replaced OpenJDK with SunJDK. java -version is "1.6.0_24" which java is /usr/bin/java
Yesterday, for the first time, I downloaded and ran an Avast! scan. It complains of "Malware-gen" in several class files in what I think is the java cache. Does anyone know how this could be?
I have installed latest Sun JDk. But when I do: java -version I still got OpenJDK version. So I completely removed OpenJDK. But now when I do:
java -version I get even older GNU java 1.5 something libgcj. So I completely removed that too but it was asking to remove bunch of dependent apps like OpenOffice.org Writer etc. Even though I need the writer, I let it go because I do not want ever to see the face of any GNU java on my linux. So everything related to GNU java is removed. Luckily I am able to start Eclipse and it works fine and start normally (apparently using the installed Sun JDK which is what I want). But now when I run
java -version I get bash: /usr/bin/java: No such file or directory Now what I need to do so that when I open any terminal window and enter java -version I should get Sun JDK version? Sun JDK is installed in /usr/java/jdk1.6.021. I also have symlinks: /usr/java/latest and /usr/java/defaults pointing to sun jdk.
As suggested in the answer, I tried the alternatives command but it did nothing. I type the --display, nothing is shown, and --config does nothing.
I want to ask how i set Linux class path for mail.jar and mysql-connector.jar. I have set the class path for java with the command.
Code:
when i do java -version it's work fine.
Also if i want to know that what shell i am using how can i find it.Also what is the command for showing class path variables or how can i see my JAVA_HOME class path.Means after setting the class path for above two files how can i see that these files have added.
When i write echo $CLASSPATH or echo $JAVA_HOME it shows nothing no error but again shows the prompt.
One thing more i want to run a java program on Linux it is in a package (named asteriskproject). It consist of 10 java files. I have run this program on windows using netbeans IDE.For this program i need to set my Linux class path for the above mentioned files, and this is my first time that i am running any program on Linux. So i want to ask how can i run my program. Simply put this asteriskproject directory in any folder and run the main file using javac. Is it right way to run the program that consist of package ?
ireverter will not launch due to a java problem: "Could not find the main class: org.thestaticvoid.iriverter.ConverterUI"
In the past a solution was to add: "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jni" before the java line in the script. This does not correct my problem.
this is an error in java not knowing its classpath. IANAP, and could use some help in resolving this.I've followed the instructions available at various sites, and the installation went fine.When I start the service I get the following in the wrapper.log:
Code: root@twin:/etc# service adito console Running Adito...
I'm fighting my way through JAVA. But have hit another wall. Basically I need to to set paths in java so it can set/read files/director for Linux,Mac and windows.
The tutorials I'm using says to do this through the FileSystems class eg
Code:
However this reports it is missing, so a look on line says I need the headers so I set them with
Code:
This gives the following error
This has me totally confused as the tutorial shows this and checking online shows this, do I need to link in libraries or something like that?
I am thinking of appending something to each line in a text file with Java. I prefer not write a new file with content appended from the old one.That 'something' would probably be Time Stamp when the file is created (which is same for each line).I am not sure Java provide some easy way for it or not