Runtime flags in jar file (java -D flags)
I need to start java with a runtime flag, this is how I do it from the DOS-promt on a NT box:
java -Dswing.disableFileChooserSpeedFix=true -cp myJarFile.jar MyMainClass
How can I put the runtime flag -Dswing.disableFileChooserSpeedFix=true into a manifest file?
// Mattias
You can't.
But it's a standard Javca Property that can be loaded off any file on the network.
So you probably should change your app to pick this property value by default.
Also try using an executable JAR file:http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html
-Alexis
Similar Messages
-
Problem using a jar file : java.lang.ClassNotFoundException: ApiConn
Hi everyone.
i am running a form that use a bean_area to call a jar.
but i am getting this error, thanks in advnce for any tip.
Java Plug-in 1.6.0_33
Using JRE version 1.6.0_33-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\user1
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>
java.lang.ClassNotFoundException: ApiConn
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at oracle.forms.handler.UICommon.instantiate(Unknown Source)
at oracle.forms.handler.UICommon.onCreate(Unknown Source)
at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Dumping class loader cache...
Live entry: key=http://192.168.10.100:7778/forms/java/,frmall.jar,siberia_jpg.jar,ApiConn.jar,Hasher.jar,ReadCommand.jar,WriteCommand.jar,libAPI.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://192.168.10.100:7778/forms/java/-threadGroup,maxpri=4]
Done.
in my form i have created a bean_area and used as implementation class :ApiConn
in my formsweb.cfg i used this configuration: archive=frmall.jar,siberia_jpg.jar,ApiConn.jar,Hasher.jar,ReadCommand.jar,WriteCommand.jar,libAPI.jar
in my forms/java i have placed my jar files listed in the frmall.jar
i guess i am missing something but i dont know what it is.
here is my ApiConn.java from wich i generate my jar file:
package libAPI;
* This contains connection. Everything should be here,
* should operate with this class only
import java.io.*;
import java.net.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
* @author janisk
public class ApiConn extends Thread {
private Socket sock = null;
private DataOutputStream out = null;
private DataInputStream in = null;
private String ipAddress;
private int ipPort;
private boolean connected = false;
private String message = "Not connected";
private ReadCommand readCommand = null;
private WriteCommand writeCommand = null;
private Thread listener = null;
LinkedBlockingQueue queue = new LinkedBlockingQueue(40);
* Constructor of the connection class
* @param ipAddress - IP address of the router you want to conenct to
* @param ipPort - port used for connection, ROS default is 8728
public ApiConn(String ipAddress, int ipPort) {
this.ipAddress = ipAddress;
this.ipPort = ipPort;
this.setName("settings");
* State of connection
* @return - if connection is established to router it returns true.
public boolean isConnected() {
return connected;
public void disconnect() throws IOException{
listener.interrupt();
sock.close();
private void listen() {
if (this.isConnected()) {
if (readCommand == null) {
readCommand = new ReadCommand(in, queue);
listener = new Thread(readCommand);
listener.setDaemon(true);
listener.setName("listener");
listener.start();
* to get IP address of the connection. Reads data from socket created.
* @return InetAddress
public InetAddress getIpAddress() {
return sock == null ? null : sock.getInetAddress();
* returns ip address that socket is asociated with.
* @return InetAddress
public InetAddress getLocalIpAddress() {
return sock == null ? null : sock.getLocalAddress();
* Socket remote port number
* @return
public int getPort() {
return sock == null ? null : sock.getPort();
* return local prot used by socket
* @return
public int getLocalPort() {
return sock == null ? null : sock.getLocalPort();
* Returns status message set up bu class.
* @return
public String getMessage() {
return message;
* sets and exectues command (sends it to RouterOS host connected)
* @param s - command will be sent to RouterOS for example "/ip/address/print\n=follow="
* @return
public String sendCommand(String s) {
return writeCommand.setCommand(s).runCommand();
* exeecutes already set command.
* @return returns status of the command sent
public String runCommand() {
return writeCommand.runCommand();
* Tries to fech data that is repllied to commands sent. It will wait till it can return something.
* @return returns data sent by RouterOS
* @throws java.lang.InterruptedException
public String getData() throws InterruptedException {
String s = (String) queue.take();
return s;
* returns command that is set at this moment. And will be exectued if runCommand is exectued.
* @return
public String getCommand() {
return writeCommand.getCommand();
* set up method that will log you in
* @param name - username of the user on the router
* @param password - password for the user
* @return
public String login(String name, char[] password) {
this.sendCommand("/login");
String s = "a";
try {
s = this.getData();
} catch (InterruptedException ex) {
Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
return "failed read #1";
if (!s.contains("!trap") && s.length() > 4) {
String[] tmp = s.trim().split("\n");
if (tmp.length > 1) {
tmp = tmp[1].split("=ret=");
s = "";
String transition = tmp[tmp.length - 1];
String chal = "";
chal = Hasher.hexStrToStr("00") + new String(password) + Hasher.hexStrToStr(transition);
chal = Hasher.hashMD5(chal);
String m = "/login\n=name=" + name + "\n=response=00" + chal;
s = this.sendCommand(m);
try {
s = this.getData();
} catch (InterruptedException ex) {
Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
return "failed read #2";
if (s.contains("!done")) {
if (!s.contains("!trap")) {
return "Login successful";
return "Login failed";
@Override
public void run() {
try {
InetAddress ia = InetAddress.getByName(ipAddress);
if (ia.isReachable(1000)) {
sock = new Socket(ipAddress, ipPort);
in = new DataInputStream(sock.getInputStream());
out = new DataOutputStream(sock.getOutputStream());
connected = true;
readCommand = new ReadCommand(in, queue);
writeCommand = new WriteCommand(out);
this.listen();
message = "Connected";
} else {
message = "Not reachable";
} catch (UnknownHostException ex) {
connected = false;
message = ex.getMessage();
ex.printStackTrace();
} catch (IOException ex) {
connected = false;
message = ex.getMessage();
ex.printStackTrace();
}I need your help again, i think this is a minor thing.
i have compiled the class file that i needed and i signed it too. but now it is giving me a new error and need your tip.
here is the java console loyout and my java file ((i think here is the problem in java file, something must be missing)).
thanks in advance for any help.
Java Plug-in 10.17.2.02
Using JRE version 1.7.0_17-b02 Java HotSpot(TM) Client VM
User home directory = C:\Users\Administrator
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>
network: Connecting http://192.168.10.100:7778/forms/lservlet;jsessionid=c0a80a6430d6e191eded93774f2f8d1bed73056e66ef.e3mObhiMbxeKe34PahiKbx4Nbh90n6jAmljGr5XDqQLvpAe with proxy=DIRECT
security: Validate the certificate chain using CertPath API
security: The certificate hasnt been expired, no need to check timestamping info
security: Cannot find jurisdiction list file
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
basic: updateValidationResultsForApplet update
cache: Mark prevalidated: http://192.168.10.100:7778/forms/java/ApiConn.jar true tm=1363335797289 cert=1371107987000
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
java.lang.InstantiationException: oracle.forms.siberia.ApiConn
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at oracle.forms.handler.UICommon.instantiate(Unknown Source)
at oracle.forms.handler.UICommon.onCreate(Unknown Source)
at oracle.forms.handler.JavaContainer.onCreate(Unknown Source)
at oracle.forms.engine.Runform.onCreateHandler(Unknown Source)
at oracle.forms.engine.Runform.processMessage(Unknown Source)
at oracle.forms.engine.Runform.processSet(Unknown Source)
at oracle.forms.engine.Runform.onMessageReal(Unknown Source)
at oracle.forms.engine.Runform.onMessage(Unknown Source)
at oracle.forms.engine.Runform.processEventEnd(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.redispatchEvent(Unknown Source)
at oracle.ewt.lwAWT.LWComponent.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
network: Connecting http://192.168.10.100:7778/forms/lservlet;jsessionid=c0a80a6430d6e191eded93774f2f8d1bed73056e66ef.e3mObhiMbxeKe34PahiKbx4Nbh90n6jAmljGr5XDqQLvpAe with proxy=DIRECT
Exception in thread "Forms-DialogThread2" java.lang.NullPointerException
at oracle.forms.handler.JavaContainer.onDestroy(Unknown Source)
at oracle.forms.engine.Runform.destroyHandlers(Unknown Source)
at oracle.forms.handler.DialogThread.doAlert(Unknown Source)
at oracle.forms.handler.DialogThread.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Dumping class loader cache...
Live entry: key=http://192.168.10.100:7778/forms/java/,frmall.jar,siberia_jpg.jar,ApiConn.jar,ConcealTextField.jar, refCount=1, threadGroup=sun.plugin2.applet.Applet2ThreadGroup[name=http://192.168.10.100:7778/forms/java/-threadGroup,maxpri=4]
Done.
here is my java file
* To change this template, choose Tools | Templates
* and open the template in the editor.
package oracle.forms.siberia;
* This contains connection. Everything should be here,
* should operate with this class only
import java.io.*;
import java.net.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.forms.*;
* @author janisk
public class ApiConn extends Thread {
private Socket sock = null;
private DataOutputStream out = null;
private DataInputStream in = null;
private String ipAddress;
private int ipPort;
private boolean connected = false;
private String message = "Not connected";
private ReadCommand readCommand = null;
private WriteCommand writeCommand = null;
private Thread listener = null;
LinkedBlockingQueue queue = new LinkedBlockingQueue(40);
* Constructor of the connection class
* @param ipAddress - IP address of the router you want to conenct to
* @param ipPort - port used for connection, ROS default is 8728
public ApiConn(String ipAddress, int ipPort) {
this.ipAddress = ipAddress;
this.ipPort = ipPort;
this.setName("settings");
* State of connection
* @return - if connection is established to router it returns true.
public boolean isConnected() {
return connected;
public void disconnect() throws IOException{
listener.interrupt();
sock.close();
private void listen() {
if (this.isConnected()) {
if (readCommand == null) {
readCommand = new ReadCommand(in, queue);
listener = new Thread(readCommand);
listener.setDaemon(true);
listener.setName("listener");
listener.start();
* to get IP address of the connection. Reads data from socket created.
* @return InetAddress
public InetAddress getIpAddress() {
return sock == null ? null : sock.getInetAddress();
* returns ip address that socket is asociated with.
* @return InetAddress
public InetAddress getLocalIpAddress() {
return sock == null ? null : sock.getLocalAddress();
* Socket remote port number
* @return
public int getPort() {
return sock == null ? null : sock.getPort();
* return local prot used by socket
* @return
public int getLocalPort() {
return sock == null ? null : sock.getLocalPort();
* Returns status message set up bu class.
* @return
public String getMessage() {
return message;
* sets and exectues command (sends it to RouterOS host connected)
* @param s - command will be sent to RouterOS for example "/ip/address/print\n=follow="
* @return
public String sendCommand(String s) {
return writeCommand.setCommand(s).runCommand();
* exeecutes already set command.
* @return returns status of the command sent
public String runCommand() {
return writeCommand.runCommand();
* Tries to fech data that is repllied to commands sent. It will wait till it can return something.
* @return returns data sent by RouterOS
* @throws java.lang.InterruptedException
public String getData() throws InterruptedException {
String s = (String) queue.take();
return s;
* returns command that is set at this moment. And will be exectued if runCommand is exectued.
* @return
public String getCommand() {
return writeCommand.getCommand();
* set up method that will log you in
* @param name - username of the user on the router
* @param password - password for the user
* @return
public String login(String name, char[] password) {
this.sendCommand("/login");
String s = "a";
try {
s = this.getData();
} catch (InterruptedException ex) {
Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
return "failed read #1";
if (!s.contains("!trap") && s.length() > 4) {
String[] tmp = s.trim().split("\n");
if (tmp.length > 1) {
tmp = tmp[1].split("=ret=");
s = "";
String transition = tmp[tmp.length - 1];
String chal = "";
chal = Hasher.hexStrToStr("00") + new String(password) + Hasher.hexStrToStr(transition);
chal = Hasher.hashMD5(chal);
String m = "/login\n=name=" + name + "\n=response=00" + chal;
s = this.sendCommand(m);
try {
s = this.getData();
} catch (InterruptedException ex) {
Logger.getLogger(ApiConn.class.getName()).log(Level.SEVERE, null, ex);
return "failed read #2";
if (s.contains("!done")) {
if (!s.contains("!trap")) {
return "Login successful";
return "Login failed";
@Override
public void run() {
try {
InetAddress ia = InetAddress.getByName(ipAddress);
if (ia.isReachable(1000)) {
sock = new Socket(ipAddress, ipPort);
in = new DataInputStream(sock.getInputStream());
out = new DataOutputStream(sock.getOutputStream());
connected = true;
readCommand = new ReadCommand(in, queue);
writeCommand = new WriteCommand(out);
this.listen();
message = "Connected";
} else {
message = "Not reachable";
} catch (UnknownHostException ex) {
connected = false;
message = ex.getMessage();
ex.printStackTrace();
} catch (IOException ex) {
connected = false;
message = ex.getMessage();
ex.printStackTrace();
} -
JAR files + java.lang.NoClassDefFoundError
Hey all ...
I'm looking for little help with building JAR files. Here's the situation: (using ant script :))
I have few source files *.java which I include into JAR file with default MANIFEST built by ant. (these files should be implemented as LIBRARY.jar)
These files are classes, which I want to use in my Main.java class. But I want this Main, to be in independant executable JAR file, so I set Main-Class property to 'packagename/Main'.
Ofcourse in all files I have set package to my default package name. My question is, how can I force java to execute MAIN.jar and look for classes in my LIBRARY.jar
after executing command:
java -jar MAIN.jar I get java.lang.NoClassDefFoundError
Tanks for any ideas ...Then all I can say in addition is that something isn't deployed correctly. You're not saying what class it isn't finding. For all I know it can't even find your main class to execute because maybe you don't have it deployed correctly in the right path structure within the jar. Or the path to LIBRARY.jar is wrong. Or some other problem. Don't know based on the portion of the error message you have displayed this far.
-
- JAVA -
Basically I have few files in one package in every one of them I worte:
"pack preyPackage;"
And I have some .jar file that I try to use. So I drag it into the oracle compiler, but I still couldnt use it. But if I delete the row:
"pack preyPackage;"
from each .java I able to use that .jar file.
my question is how can I still use that .jar file and package's all that other files..
Picture that shows the problem:
http://hwzone.co.il/community/index.php?action=dlattach;topic=290416.0;attach=92107;image
Thanks.Tried it and get strange behaviours in JDev 10.1.3.3...
The latest version with sources can be found at
http://stwww.weizmann.ac.il/G-CS/BENARI/oop/index.html
You should get that one and modify the sources to include a package name.
I have little time to do that because I'm going on holiday for a week...
--olaf -
Simple but wierd java.lang.NoClassDefFoundError with jar file
I'm using ant to jar my .class files. My final objective is to create an executable jar. When I run my jar file - "java -jar PM.jar" - I get:
Exception in thread "main" java.lang.NoClassDefFoundError: pm/PMApp
This at least tells me that java found my MANIFEST.MF class and that is the correct class it should be looking for, but it doesn't seem to find the class. But when I do - "jar -tf PM.jar" - I get:
C:\mike\pm\execs>jar -tf PM.jar
META-INF/
META-INF/MANIFEST.MF
pm/
pm/EasterEgg.class
pm/JMSMessageListener.class
pm/PMApp.class
pm/ReleasePlanTest.class
pm/SystemArchitectureFrame$1.class
pm/SystemArchitectureFrame$2.class
pm/SystemArchitectureFrame$3.class
pm/SystemArchitectureFrame$4.class
pm/SystemArchitectureFrame$5.class
pm/SystemArchitectureFrame$6.class
pm/SystemArchitectureFrame$7.class
pm/SystemArchitectureFrame$8.class
pm/SystemArchitectureFrame.class
pm/SystemArchitecturePanel.class
Which shows me that the class is there. I suspected that it might have something to do with CLASSPATH at first because of the java.lang.NoClassDefFoundError, but now I am skeptical that that could be the problem. I even build a new jar file out of different classes to make sure my method was OK and that worked fine. Any ideas? Thanks for your help in advance.Here is my Manifest:
Main-Class: pm.PMApp<carriage return>
Class-Path: C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
I noticed that if I leave the Class-Path variable unset it has no problem finding the class pm/PMApp, but I then get a class loader error concerning J2EE stuff. Am I missing something in my Class-Path? I tried to even specify the jar file I'm running here, but that didn't work either? I have also tried '.' and './', space delimited in my Class-Path, like this:
Class-Path: . ./ C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
Thanks for the replies, do you have any more suggestions? -
How Can i open Html file in a Browser from Jar file
Hi
i am having Html help files inside my Jar file ... if i use
getclass().getRource("\lib\start.html");
it is not opening ... so i have to ship seperate folders for html files along with jar files.... can anyone give the solution to have(open) html files inside the jar file and to open then in a default browser of any OS
Regards
Ganesan Sthe follwing method i have used to open html file ...
so to access html file i am shipping resources folder with jar file ..
private void openHtmlPages(String pageName) {
String cmd[] = new String[2];
String browser = null;
File file = null;
if(System.getProperty("os.name").indexOf("Linux")>-1) {
file = new File("/usr/bin/mozilla");
if(!file.exists() ) {
}else {
browser = "mozilla";
}else {
browser = "<path of iexplore>";
cmd[0] = browser;
File files = new File("");
String metaData = "/resources/Help/Files/"+pageName+".html"; // folder inside jar file
java.net.URL url = this.getClass().getResource(metaData);
String fileName = url.getFile();
fileName = fileName.replaceAll("file:/","");
fileName = fileName.replaceAll("%2520"," ");
fileName = fileName.replaceAll("%20"," ");
fileName = fileName.replaceAll("jarfilename.jar!"," ").trim();
cmd[1] = fileName;
try{
Process p = Runtime.getRuntime().exec(cmd);
}catch(java.io.IOException io){
//Ignore
can anyone give me the solution..???
Regards
Ganesan S -
Unable to access classes in third party jar files packaged with my ejb.jar
I have packaged some third party jar files in my xxx_ejb.jar file. The third party jar file contains classes that are accessed by some custom classes which are in turn accessed by my bean classes. I get the following error when my custom classes attempt to use any of the classes in one of the third party jar files:
java.lang.NoClassDefFoundError: com/Ostermiller/util/CSVParser
Shouldn't I be able to access classes in jar files that are packaged with my xxx_ejb.jar file? I see the xxx_ejb.jar file as a resource of the application classloader that contains it but I don't see the third party jar files.As per the Java EE specification, additional JAR files should be packaged on the EAR level. Only WAR files' WEB-INF/lib folder is scanned for JAR files to be added to the classloader.
-
Hi
I have created a ja file containing my whole project.
the jar file contains a java class which contains a main method.
now i want to run this java class present in my jar file from the command prompt. is it possible to do it. can we run a java file which is inside the jar file.
i don't want to extract the jar file to run the java class.
Please let me know what needs to be done in this case.
Thanks & Regards
Vikengnow i want to run this java class present in my jar
file from the command prompt. is it possible to do
it. can we run a java file which is inside the jar
file.
java -jar MyJar.jarYou need to set the Main-Class attribute in the manifest, though. -
I have created an application and I have used JCreator to compile and run it.
My next step is that I want to make my application as executable jar
I did the following:
1- I made a package name called transpackage and I have include it in each file
2- I have executed the command : jar cfm MyJar.jar Manifest.txt transpackage/*.class
3- Manifest.txt file contains the following line :
Main-Class: transpackage.JavaTrans and an empty line after it.
4- If I executed the follwing line to run the jar file:
java -jar MyJar.jar
I got the follwing error:
Exception in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTran
s com/sun/jdi/connect
Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans com.sun.jdi.
connect
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Please advise what the problem here is. I couldn't figure it out. Thanks for helpHere is a copy of my command line:
C:\Documents and Settings\isz\Desktop\JavaTrans>jar cvfm MyJar.jar manifest.mft transpackage\*.classadded manifest
adding: transpackage/EventThread$ThreadTrace.class(in = 5566) (out= 2396)(deflat
ed 56%)
adding: transpackage/EventThread.class(in = 9867) (out= 4114)(deflated 58%)
adding: transpackage/Info.class(in = 1036) (out= 484)(deflated 53%)
adding: transpackage/JavaTrans$1.class(in = 2531) (out= 1304)(deflated 48%)
adding: transpackage/JavaTrans$2.class(in = 1330) (out= 731)(deflated 45%)
adding: transpackage/JavaTrans$3.class(in = 611) (out= 392)(deflated 35%)
adding: transpackage/JavaTrans$DemoAction.class(in = 2953) (out= 1567)(deflated
46%)
adding: transpackage/JavaTrans.class(in = 36020) (out= 15723)(deflated 56%)
adding: transpackage/StepInfo.class(in = 1842) (out= 758)(deflated 58%)
adding: transpackage/StreamRedirectThread.class(in = 2308) (out= 1238)(deflated
46%)
C:\Documents and Settings\iszalans\Desktop\JavaTrans>java -jar MyJar.jarException in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTrans
Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source) -
Read a txt file when I run jar file
Hi all,
I have a jar file. In ir there are:
/file.jar
|----/pack
| |----MyClass.class
| |----file.txt
|
|----/META-INF
| |----MANIFEST.MFI want: when I execute the jar file java -jar file.jar from the java class MyClass to read the file.txt
When I run this the error is:
C:\Documents and Settings\pc\Escritorio>java -jar file.jar
java.io.FileNotFoundException: file:\C:\Documents%20and%20Settings\pc\Escritorio\file.jar!\pack\file.txt (El nombre de archivo, directo
rio o etiqueta del volumen no es valido)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileReader.<init>(Unknown Source)
at pack.MyClass.main(MyClass.java:20)
Exception in thread "main" java.lang.NullPointerException
at pack.MyClass.main(MyClass.java:31)the code into the java class is:
package pack;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
public class MyClass {
private static String version = null;
static String fich = "file.txt";
public static void main(String[] args) {
BufferedReader br = null;
File file = new File(fich);
try {
br = new BufferedReader(new FileReader(MyClass.class.getClass().getResource("/pack/file.txt").getPath()));
String j= null;
while ((j = br.readLine())!=null){
version = j;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException io){
io.printStackTrace();
} finally{
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
if (version != null)
System.out.println("I have read : "+version);
}in MANIFEST.MF file:
Manifest-Version: 1.0
Main-Class: pack.MYClassthanks very muchthanks you!!
I have read the file, but I have put the package when I write the file.txt, beacuse If I don't put this, givas me NullPointerException
Now I have
InputStream in = Main.class.getResourceAsStream("/pack/file.txt");
InputStreamReader isr = null;
BufferedReader reader = null;
try {
isr = new InputStreamReader(in, "ISO-8859-1");
reader = new BufferedReader(isr);
while ((j = reader.readLine())!=null){
version = j;
reader.close();
} catch ...Thanks very much -
Creating jar file for entity bean
I am trying to deploy an entity bean..i compiled all the java files and created a dir by name META_INF and copied ejb-jar.xml
and the other two .xml files which are needed to this dir. then using ,ant i tried to create the jar file ,,but it is giving the following error
during the process ..PLs Help me
Buildfile: build.xml
clean:
[delete] Deleting directory D:\ejb\entity\build
[delete] Deleting directory D:\ejb\entity\dist
init:
[mkdir] Created dir: D:\ejb\entity\build
[mkdir] Created dir: D:\ejb\entity\build\META-INF
[mkdir] Created dir: D:\ejb\entity\dist
compile_ejb:
[javac] Compiling 3 source files to D:\ejb\entity\build
jar_ejb:
[jar] Building jar: D:\ejb\entity\dist\Cabin.jar
ejbc:
[java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
[java] at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
[java] at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
[java] at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
[java] at weblogic.ejbc20.runBody(ejbc20.java:338)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:79)
[java] at weblogic.ejbc.main(ejbc.java:21)
[java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar file
compile_webapp:
Total time: 20 secondThe Ejb jar file structure for WebLogic server:
META-INF/ejb-jar.xml
META-INF/weblogic-ejb-jar.xml
META-INF/weblogic-cmp-rdbms-jar.xml
Ejb Bean Class
Remote interface
Home interface -
How to run jar files with arguments?
Hi everybody,
Is it possible to run a jar file with arguments passed to its MAIN class?
If yes can you help me on how to do it?
ThanxI am in complete agreement with FahleE. I'll refine it a bit.
On my machine (running RedHatLinux8.0) you can run the demos like this.
1. open a console window
2. go to the directory where the demo you wish to run, say, demo.jar, is located
for instance for the SwingSet2-demo
cd /usr/lib/java/demo/jfc/SwingSet2
3. run the jar file
java -jar demo.jar
In order to run it windows style, ie, launching by double clicking, save these lines in a file called
LaunchJar.sh
cd /usr/lib/java/demo/jfc/SwingSet2
java -jar demo.jar
where demo.jar is the jar file you want to run.
Right click on the LaunchJar.sh and go to the 'Properties' tab. Check the 'Execute' permissions for Owner/groups/others. You can also do the same thing by chmod command.
Now double-click on the LaunchJar.sh file: your application should be launched.
Palash.
Please Note: It is important to set the path variable to your JAVA_HOME directory....
Otherwise, instead of
java -jar demo.jar, you will need to use the full path to your JAVA_HOME/bin directory like:
JAVA_HOME/bin /java -jar demo.jar.
Where JAVA_HOME is the directory where you have installed java. Typically it is usr/java or usr/local/java -
Hi All,
I am new to Netweaver. I have downloaded few sample applications from this site.
If any one can help me in getting jar files for the below packages it would be of great help.
com.sap.pct.srv.portaldataviewer_api.jar
com.sap.pct.srv.portaldataviewer_core.jar
com.sap.portal.compatibility50.jco_api.jar
com.sap.portal.compatibility50.jco_core.jar
com.sap.portal.runtime.application.jcoclient_api.jar
com.sap.portal.runtime.application.jcoclient_core.jar
jcoconnection_api.jar
prtconnection.jar
prtjndisupport.jar
prtregistry.jar
If you know atleast one of the path Please let me know.
It would be grateful for you.
And I find from SDN that we can logon to portal system administration->support->portal runtime->etc link.
But I am unable to find out that portal runtime link in portal.
Please let me know. I have to finish this issue.
Regards,
Subashini.JHi,
you can find these files on your portal at location
<b>prtjindisupport.jar & prtregistry[/b are at:
system admin -->support -->portal run time -->browse deployment -->WEB-INF/lib
<b>com.sap.portal.runtime.application.jcoclient_api.jar</b> file is at
system admin -->support -->portal run time -->browse deployment -->/WEB-INF/portal/portalapps/com.sap.portal.runtime.application.jcoclient/lib
<b>
com.sap.portal.runtime.application.jcoclient_core.jar files</b>
system admin -->support -->portal run time -->browse deployment -->WEB-INF/portal/portalapps/com.sap.portal.runtime.application.jcoclient/private/lib
Regards,
Ameya -
Building the webservice jar file
I have a problem with the underlying errormsg. Could anyone help.
Below the errormsg i have included the content of the jar file, where ant claims
ejb-jar.xml missing. (I've even given full rights to the files before packing in
jar).
Thanx in advance!
Michael Nielsen
Buildfile: build.xml
webservice:
clean:
init:
[mkdir] Created dir: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build
[mkdir] Created dir: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build/META-INF
[copy] Copying 3 files to /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build/META-INF
compile_ejb:
jar_ejb:
[jar] Building jar: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/a_statelessSession.jar
ejbc:
[java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar
file
[java] at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
[java] at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
[java] at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
[java] at weblogic.ejbc20.runBody(ejbc20.java:338)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:79)
[java] at weblogic.ejbc.main(ejbc.java:21)
[java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found
in jar file
[java] Java Result: 1
all:
wsgen:
BUILD FAILED
/home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build-ws.xml:12:
Could not create task of type: wsgen. Common solutions are to use taskdef to declare
your task, or, if this is an optional task, to put the optional.jar in the lib directory
of your ant installation (ANT_HOME).
CONTENT OF THE JAR FILE profil.jar
0 Wed Jul 10 15:17:50 CEST 2002 META-INF/
71 Wed Jul 10 15:17:50 CEST 2002 META-INF/MANIFEST.MF
776 Wed Jul 10 13:39:14 CEST 2002 ProfilVO.class
789 Wed Jul 10 13:39:14 CEST 2002 StamdataVOI.class
442 Wed Jul 10 13:39:12 CEST 2002 EmailVOI.class
509 Wed Jul 10 13:39:10 CEST 2002 AbonnementVOI.class
345 Wed Jul 10 13:39:00 CEST 2002 AdresseVOI.class
455 Wed Jul 10 13:39:10 CEST 2002 InteresseVOI.class
413 Wed Jul 10 13:39:14 CEST 2002 ProfilIF.class
447 Wed Jul 10 13:39:12 CEST 2002 TelefonVOI.class
332 Wed Jul 10 13:39:10 CEST 2002 ProfilHome.class
6966 Wed Jul 10 13:39:10 CEST 2002 ProfilBean.class
1804 Wed Jul 10 14:58:00 CEST 2002 build-ejb.xml
477 Wed Jul 10 13:49:24 CEST 2002 META-INF/weblogic-ejb-jar.xml
918 Wed Jul 10 13:47:54 CEST 2002 META-INF/ejb-jar.xmlHi,
Could you give us a few more details. What version of WLS are U using and if you could turn on -verbose on the ant command
and post the results.
Thanks,
Bruce
Michael Nielsen wrote:
I have a problem with the underlying errormsg. Could anyone help.
Below the errormsg i have included the content of the jar file, where ant claims
ejb-jar.xml missing. (I've even given full rights to the files before packing in
jar).
Thanx in advance!
Michael Nielsen
Buildfile: build.xml
webservice:
clean:
init:
[mkdir] Created dir: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build
[mkdir] Created dir: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build/META-INF
[copy] Copying 3 files to /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build/META-INF
compile_ejb:
jar_ejb:
[jar] Building jar: /home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/a_statelessSession.jar
ejbc:
[java] java.io.FileNotFoundException: META-INF/ejb-jar.xml not found in jar
file
[java] at weblogic.ejb20.dd.xml.DDUtils.getEntry(DDUtils.java:332)
[java] at weblogic.ejb20.dd.xml.DDUtils.getEjbJarXml(DDUtils.java:236)
[java] at weblogic.ejb20.dd.xml.DDUtils.loadEJBJarDescriptorFromJarFile(DDUtils.java:151)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:139)
[java] at weblogic.ejb20.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:130)
[java] at weblogic.ejbc20.runBody(ejbc20.java:338)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:79)
[java] at weblogic.ejbc.main(ejbc.java:21)
[java] ERROR: java.io.FileNotFoundException: META-INF/ejb-jar.xml not found
in jar file
[java] Java Result: 1
all:
wsgen:
BUILD FAILED
/home/min1210/mille6/classes/dk/dsb/mille/integration/webservice/profil/build-ws.xml:12:
Could not create task of type: wsgen. Common solutions are to use taskdef to declare
your task, or, if this is an optional task, to put the optional.jar in the lib directory
of your ant installation (ANT_HOME).
CONTENT OF THE JAR FILE profil.jar
0 Wed Jul 10 15:17:50 CEST 2002 META-INF/
71 Wed Jul 10 15:17:50 CEST 2002 META-INF/MANIFEST.MF
776 Wed Jul 10 13:39:14 CEST 2002 ProfilVO.class
789 Wed Jul 10 13:39:14 CEST 2002 StamdataVOI.class
442 Wed Jul 10 13:39:12 CEST 2002 EmailVOI.class
509 Wed Jul 10 13:39:10 CEST 2002 AbonnementVOI.class
345 Wed Jul 10 13:39:00 CEST 2002 AdresseVOI.class
455 Wed Jul 10 13:39:10 CEST 2002 InteresseVOI.class
413 Wed Jul 10 13:39:14 CEST 2002 ProfilIF.class
447 Wed Jul 10 13:39:12 CEST 2002 TelefonVOI.class
332 Wed Jul 10 13:39:10 CEST 2002 ProfilHome.class
6966 Wed Jul 10 13:39:10 CEST 2002 ProfilBean.class
1804 Wed Jul 10 14:58:00 CEST 2002 build-ejb.xml
477 Wed Jul 10 13:49:24 CEST 2002 META-INF/weblogic-ejb-jar.xml
918 Wed Jul 10 13:47:54 CEST 2002 META-INF/ejb-jar.xml -
Hi, i need the following jar files:
com.sap.pct.srv.portaldataviewer_api.jar
com.sap.pct.srv.portaldataviewer_core.jar
com.sap.portal.compatibility50.jco_api.jar
com.sap.portal.compatibility50.jco_core.jar
com.sap.portal.runtime.application.jcoclient_api.jar
com.sap.portal.runtime.application.jcoclient_core.jar
jcoconnection_api.jar
prtjndisupport.jar
prtregistry.jar
Can anyone tell me where to find them?
Regards,
Padmalatha.KHi,
you could get those files at
<b>prtjindisupport.jar & prtregistry files are at :</b>
\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\lib
<b>com.sap.portal.runtime.application.jcoclient_api.jar & com.sap.portal.runtime.application.jcoclient_core.jar files are at :</b>
\usr\sap\J2E\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal.runtime.application.jcoclient\lib
Maybe you are looking for
-
You can download past purchases on this computer with just one Apple ID every 90 days. This computer can be used with a different Apple ID in 41 days. I keeo getting this message ehat is wrong with
-
Defaulting Payment Term & Determining due date
Dear All, We are using the substituions to default the payment term to ZS28 for document type ZO. In the transaction FB60 after entering the document date and other details, If I click on the payment tab the payment term is being populated correctly
-
I am trying to print a 600kb pdf on an HPlaserjet 3005 via IP. It prints from a PC and other files print from my iMac G5 1.9 1GB 10.4.11. I reinstalled the printers via System Preferences and downloaded and installed the relevant HP driver - all to n
-
RLS Solutions with BI Applications
If I have customer that has a BI application that queries a table for say the average of the salary column. If they introduce a row-level security solution like VPD or OLS and a subset of the rows are redacted for that BI query (say policy is you onl
-
I would like to experiment for the first time with a client export from SBX to DEV. I would like to know the exact steps as I am a bit confused with what I have read. Do I need to have considerable space available on the target as well as the source