Could not find the main class:

Rol

Aktives Mitglied
Hallo,

ich möchte folgendes Java Programm zum laufen bringen:
IBController | Download IBController software for free at SourceForge.net

Ich starte das Programm wie in der readme.txt angegeben in der Kommandozeile mit:

Code:
java.exe -cp  C:\Jts\ IBController.jar ibcontroller.IBController

"C:\Jts" ist dabei ein Pfad zu einem anderen Javaprogram welches später von diesem gestertet werden soll.

Dann erhalte ich folgende Fehlermeldung:

Code:
C:\IBControllerV2-8-4-1>java.exe -cp  C:\Jts\ IBController.jar ibcontroller.IBCo
ntroller
Exception in thread "main" java.lang.NoClassDefFoundError: IBController/jar
Caused by: java.lang.ClassNotFoundException: IBController.jar
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: IBController.jar.  Program will exit.

Ich kann mir nicht vorstellen, dass es am Programm selbt liegt. Es läuft auf anderen Rechnern (angeblich) problemmlos. Ich vermute vielmehr, dass auf meinem Rechner irgendetwas mit den Pfaden falsch ist.

"Set" in der cmd bringt mir:

Code:
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Rol\AppData\Roaming
asl.log=Destination=file
CLASSPATH=.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=BUERO
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Rol
IBCDIR=C:\IBController
IBCINI=C:\IBController\ibcontroller.ini
JAVAOPTS=-Dsun.java2d.noddraw=true -Xmx512M
LOCALAPPDATA=C:\Users\Rol\AppData\Local
LOGONSERVER=\\BUERO
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32
\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program F
iles (x86)\Java\jdk1.6.0_21\bin;C:\Program Files (x86)\Java\jre1.6.0_20\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=AMD64 Family 15 Model 107 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=6b02
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
QTJAVA=C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\Rol\AppData\Local\Temp
TMP=C:\Users\Rol\AppData\Local\Temp
TWSCP=jts.jar;pluginsupport.jar;hsqldb.jar;jcommon-1.0.12.jar;jfreechart-1.0.9.j
ar;jhall.jar;other.jar;rss.jar;riskfeed.jar
TWSDIR=C:\Jts\
TWSPASSWORD=paula11
TWSUSERID=jensn756
USERDOMAIN=Buero
USERNAME=Rol
USERPROFILE=C:\Users\Rol
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
windir=C:\Windows

MfG
Rol
 

mvitz

Top Contributor
Code:
java.exe -cp C:\Jts\ IBController.jar ibcontroller.IBController

Ist das Leerzeichen zwischen C:\Jts\ und OBController.jar nur hier im Forum oder auch von dir?
 

Rol

Aktives Mitglied
Hallo mvitz,

ich weiß jetzt gar nicht mehr wie die "Urvariante" war, aber egal ob mit oder ohne Leerzeichen, es kommt derselbe Fehler.
 
M

MiDniGG

Gast
Reicht es nicht, wenn man nur
Code:
java -cp C:\Jts\ ...
eingibt? Also halt ohne ".exe"?

Interessant wäre mal zu wissen, in welchem Ordner Du die IBController.jar versuchst auszuführen. Denn wenn du in der cmd im Ordner C:\ bist und die JAR unter C:\Programme\Was-weiß-ich\ liegt, kommst Du mit diesem Command nicht weit...
 

AmunRa

Gesperrter Benutzer
So hab mir mal selbst die Datei heruntergeladen und und dann das jar Archiv in den Ordner C:\test kopiert. danach die CMD geöffnet und folgende befehle eingegeben

Code:
cd C:\Test
java -cp IBController.jar ibcontroller.IBController

und das programm hat sich gestartet.
 

Rol

Aktives Mitglied
Nur "C:\Jts" soll in den Classpath, "IBController.jar" ist das jar welches ich starten möchte und "ibcontroller.IBController" soll (wohl?) die Main bezeichnen.

Hier ein auszug aus der mitgelieferten readme.txt



The command for running IBController has the following basic form:

java -cp <classpath> <otherOptions> <entryPoint> [<config file>|NULL] [<loginId> <password>]

where

<classpath>
tells the Java virtual machine where to look to find
the class files that must be loaded in order to run both
IBController and TWS. You must ensure that all the information
from the corresponding item in the command to run TWS without
IBController is included, PLUS the path and name of the
IBController.jar file. Note that this information may vary
in different releases of TWS.

To find this information on Windows, locate the entry to start
TWS in your start menu (usually Start > All Programs > Trader
Workstation 4.0 > Trader Workstation 4.0). Right click on this
entry and select Properties from the pop-up menu. The command
is in the field labelled 'Target'.

Note that the classpath in the TWS shortcut assumes that the
TWS files are in the same folder as the shortcut. If your
command file runs in a different folder (for example the folder
where the IBController files are stored) you will need to:

EITHER make sure each classpath item is prefixed with the path
to the TWS files folder

OR your command file can change directory to the TWS files
folder before issuing the java command (this is what
the sampleIBControllerStart.bat file does)

<otherOptions>
these are items which modify the behaviour of the
Java VM. Examples that are used by TWS include:

-Dsun.java2d.noddraw=true
-Xmx512M

Any such options that appear in the command to start TWS should
also be included in the command to start IBController.

<entryPoint>
indicates whether to start TWS or the IB Gateway. Must be one
of the following values (note that these are case-sensitive):

ibcontroller.IBController (to start TWS)
ibcontroller.IBGatewayController (to start IB Gateway)

<config file>
is the path and name of the configuration file.
If this is not supplied or has the value NULL, then
IBController will look for a file called
IBController.<username>.ini in the working directory,
where <username> is your username on your computer
(NOT your IB account username).

<loginId>
is your TWS login id.

<password>
is your TWS password.

Note that if you don't supply <loginId> and <password> in the command
then they must be in the configuration file as described in 3.3.

Unix example for TWS 865, using a configuration file called demo.ini:

$ cd opt/IBJts
$ java -server -cp jcommon-1.0.0.jar:pluginsupport.jar:jfreechart-1.0.0.jar:jhall.jar:\
> jts.jar:eek:ther.jar:rss.jar:/opt/IBController.jar \
> ibcontroller.IBController /opt/IBController/demo.ini
 

L-ectron-X

Gesperrter Benutzer
Falls es noch nicht kam, probieres es auch mal so:
Code:
java -cp .;C:\Jts\IBController.jar ibcontroller.IBController

oder so:

Code:
java -jar .;C:\Jts\IBController.jar
 

AmunRa

Gesperrter Benutzer
Nur "C:\Jts" soll in den Classpath

Tschuldigung das ich das sage aber das ist ein Blödsinn. natürlich muss IBController.jar in den Classpath vl, muss für dein Programm auch der Ordner C:\Jts in den CP, aber um das jar archiv das in der dem zip liegt das man downloaden kann, muss nur das Archiv in den cp steht übrigens sogar genau so wie ich es in meinem Post geschrieben habe in der readme
 

Rol

Aktives Mitglied
Code:
java -cp C:\Cts;IBController.jar ibcontroller.IBController

Dann fliegt mir das hier um die Ohren:


Code:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Steffen>cd ..

C:\Users>cd ..

C:\>cd IBControllerV2-8-4-1

C:\IBControllerV2-8-4-1>test

C:\IBControllerV2-8-4-1>java -cp C:\Cts;IBController.jar ibcontroller.IBControll
er
System Properties
------------------------------------------------------------
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = C:\Program Files (x86)\Java\jdk1.6.0_21\jre\bin
java.vm.version = 17.0-b16
java.vm.vendor = Sun Microsystems Inc.
java.vendor.url = [url=http://java.sun.com/]Oracle Technology Network for Java Developers[/url]
path.separator = ;
java.vm.name = Java HotSpot(TM) Client VM
file.encoding.pkg = sun.io
sun.java.launcher = SUN_STANDARD
user.country = DE
sun.os.patch.level =
java.vm.specification.name = Java Virtual Machine Specification
user.dir = C:\IBControllerV2-8-4-1
java.runtime.version = 1.6.0_21-b06
java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs = C:\Program Files (x86)\Java\jdk1.6.0_21\jre\lib\endorsed
os.arch = x86
java.io.tmpdir = C:\Users\Steffen\AppData\Local\Temp\
line.separator =

java.vm.specification.vendor = Sun Microsystems Inc.
user.variant =
os.name = Windows 7
sun.jnu.encoding = Cp1252
java.library.path = C:\Program Files (x86)\Java\jdk1.6.0_21\bin;.;C:\Windows\Sun
\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windo
ws\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x
86)\QuickTime\QTSystem\;C:\Program Files (x86)\Java\jdk1.6.0_21\bin;C:\Program F
iles (x86)\Java\jre1.6.0_20\bin;
java.specification.name = Java Platform API Specification
java.class.version = 50.0
sun.management.compiler = HotSpot Client Compiler
os.version = 6.1
user.home = C:\Users\Steffen
user.timezone =
java.awt.printerjob = sun.awt.windows.WPrinterJob
file.encoding = Cp1252
java.specification.version = 1.6
java.class.path = C:\Cts;IBController.jar
user.name = Steffen
java.vm.specification.version = 1.0
java.home = C:\Program Files (x86)\Java\jdk1.6.0_21\jre
sun.arch.data.model = 32
user.language = de
java.specification.vendor = Sun Microsystems Inc.
awt.toolkit = sun.awt.windows.WToolkit
java.vm.info = mixed mode, sharing
java.version = 1.6.0_21
java.ext.dirs = C:\Program Files (x86)\Java\jdk1.6.0_21\jre\lib\ext;C:\Windows\S
un\Java\lib\ext
sun.boot.class.path = C:\Program Files (x86)\Java\jdk1.6.0_21\jre\lib\resources.
jar;C:\Program Files (x86)\Java\jdk1.6.0_21\jre\lib\rt.jar;C:\Program Files (x86
)\Java\jdk1.6.0_21\jre\lib\sunrsasign.jar;C:\Program Files (x86)\Java\jdk1.6.0_2
1\jre\lib\jsse.jar;C:\Program Files (x86)\Java\jdk1.6.0_21\jre\lib\jce.jar;C:\Pr
ogram Files (x86)\Java\jdk1.6.0_21\jre\lib\charsets.jar;C:\Program Files (x86)\J
ava\jdk1.6.0_21\jre\classes
java.vendor = Sun Microsystems Inc.
file.separator = \
java.vendor.url.bug = [url=http://java.sun.com/cgi-bin/bugreport.cgi]Report a Bug or Request a Feature[/url]
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
sun.desktop = windows
sun.cpu.isalist =
------------------------------------------------------------
16:10:00:853 IBController: ini file is C:\IBControllerV2-8-4-1\IBController.stef
fen.ini
16:10:00:866 IBController: IBControllerServer is started.
16:10:00:886 IBController: IBControllerServer listening on address: Buero/192.16
8.11.3 port: 7462
Exception in thread "main" java.lang.NoClassDefFoundError: jclient/LoginFrame
        at ibcontroller.IBController.startTws(IBController.java:395)
        at ibcontroller.IBController.startTwsOrGateway(IBController.java:402)
        at ibcontroller.IBController.load(IBController.java:167)
        at ibcontroller.IBController.main(IBController.java:147)
Caused by: java.lang.ClassNotFoundException: jclient.LoginFrame
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        ... 4 more
 

AmunRa

Gesperrter Benutzer
Da fliegt dir nichts um die Ohren, sondern das ist die Ausgabe des Programms

und der fehler unten kommt wohl von einer fehlerhaften ini file keine Ahnung was das ist, da ich das Programm nicht kenne
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
B Linux - Error: Could not find or load main class application.Main Java Basics - Anfänger-Themen 28
P could not find main class obwohl da Java Basics - Anfänger-Themen 17
P Compiler-Fehler Could not load or find main class fehler Java Basics - Anfänger-Themen 15
P Compiler-Fehler could not find or load main class Java Basics - Anfänger-Themen 5
E Could not find the main class! Java Basics - Anfänger-Themen 11
Prodriver22 Erste Schritte "Could not find Main Class" Problem Java Basics - Anfänger-Themen 17
B JAR Could not find main class Java Basics - Anfänger-Themen 13
Q Could not find main class: XXX.main. Programm will exit Java Basics - Anfänger-Themen 4
C Eclipse JAR Export could not find main class Java Basics - Anfänger-Themen 13
S OOP "Could not find the main class" Java Basics - Anfänger-Themen 10
D Could not find main class Java Basics - Anfänger-Themen 3
C Could not find the main class. Java Basics - Anfänger-Themen 14
B Could not find the main class. program will exit Java Basics - Anfänger-Themen 11
T could not be find the main class Java Basics - Anfänger-Themen 3
P Hello World-Programm: XPSP3 mit Java 1.6.0_16: Could not find main class Hello.java Java Basics - Anfänger-Themen 11
S Runnable jar "Could not find main class" Java Basics - Anfänger-Themen 8
O Problem mit jar "Could not find main class" Java Basics - Anfänger-Themen 9
M Could not find the main class. --> Und was mach ich jetzt Java Basics - Anfänger-Themen 6
B could not find the main class Java Basics - Anfänger-Themen 8
P could not find the main class (Eclipse) Java Basics - Anfänger-Themen 2
H Could not find the main Class, program will exit Java Basics - Anfänger-Themen 2
I Could not find the main class. Program will exit! Java Basics - Anfänger-Themen 3
R Could not find main method Java Basics - Anfänger-Themen 3
R Could not find Main-Method Java Basics - Anfänger-Themen 4
W Cannot find Symbol Java Basics - Anfänger-Themen 5
D Cannot find JUnit.framework Java Basics - Anfänger-Themen 1
A Thread find number Java Basics - Anfänger-Themen 8
A Cannot find symbol mit Konstruktoren Java Basics - Anfänger-Themen 27
A Cannot find symbol bei exceptions Java Basics - Anfänger-Themen 2
L cannot find symbol variable Kon Java Basics - Anfänger-Themen 8
F Erste Schritte error: cannot find symbol Java Basics - Anfänger-Themen 5
R return: cannot find symbol Java Basics - Anfänger-Themen 2
L Bluej Error: Cannot find Symbol Java Basics - Anfänger-Themen 13
S Cannot find symbol (symbol ist eine Variable) Java Basics - Anfänger-Themen 13
N Cannot find symbol Java Basics - Anfänger-Themen 18
D Datentypen Datentyperstellung | Kompiler sagt Syntax Error doch ich find keine Lösung Java Basics - Anfänger-Themen 2
P Irgendein billiger Fehler aber ich find ihn nicht Java Basics - Anfänger-Themen 16
P Cannot find symbol, wieso? Java Basics - Anfänger-Themen 5
N Java find - findet nix Java Basics - Anfänger-Themen 1
M Erste Schritte cannot find symbol - Probleme mit Klassen Java Basics - Anfänger-Themen 6
J Error: cannot find symbol - variable Java Basics - Anfänger-Themen 3
F Erste Schritte parseint: cannot find symbol Java Basics - Anfänger-Themen 6
J TCP MultiThreaded Server und Client - irgendwo ist der Fehler, aber ich find ihn nicht Java Basics - Anfänger-Themen 3
J Can't find symbol - Erstellung eines Objekts in if-Bedingung Java Basics - Anfänger-Themen 3
J Input/Output Can not find symbol Java Basics - Anfänger-Themen 2
M Vererbung - Cannot Find Symbol constructor... Java Basics - Anfänger-Themen 11
D error: cannot find symbol Java Basics - Anfänger-Themen 3
B Frage zu Beispielprogramm: "error: cannot find symbol" Java Basics - Anfänger-Themen 2
BlueMountain Erste Schritte error: cannot find symbol Java Basics - Anfänger-Themen 2
L Error: Cannot find symbol Java Basics - Anfänger-Themen 1
P Cannot find Symbol Java Basics - Anfänger-Themen 3
L Cannot Find Symbol - Was soll denn das bedeuten?!? Java Basics - Anfänger-Themen 7
P StdIn.readDouble: cannot find symbol Java Basics - Anfänger-Themen 7
B Fehler "Cannot find symbol - variable number1" Java Basics - Anfänger-Themen 13
B Compiler-Fehler cannot find symbol Java Basics - Anfänger-Themen 6
K Cannot find symbol Java Basics - Anfänger-Themen 3
H cannot find symbol Java Basics - Anfänger-Themen 4
S cannot find symbol, symbol: constructor Java Basics - Anfänger-Themen 2
3 Compiler-Fehler Fehlerbehebung cannot find Symbol Java Basics - Anfänger-Themen 4
R Compiler-Fehler Cannot find symbol (Method printIn) Java Basics - Anfänger-Themen 3
R Classpath java.io.IOException: Could not find resource mybatis-config.xml Java Basics - Anfänger-Themen 5
B Polymorphie A obj = new B; "cannot find symbol app()" Java Basics - Anfänger-Themen 5
S wieso Fehlermeldung cannot find symbol hier Java Basics - Anfänger-Themen 10
H Scanner (can not find symbol) Java Basics - Anfänger-Themen 15
T Cannot find Symbol(String) Java Basics - Anfänger-Themen 9
2 Compiler-Fehler cannot find symbol Java Basics - Anfänger-Themen 13
B Erste Schritte cannot find symbol - problem Java Basics - Anfänger-Themen 9
D Cannot find symbol variable Java Basics - Anfänger-Themen 9
A Compiler-Fehler Cannot find Symbol Java Basics - Anfänger-Themen 6
V Packages: Cannot find symbol Java Basics - Anfänger-Themen 12
G Collections.binarySearch(LinkedList): cannot find method Java Basics - Anfänger-Themen 6
R Cannot find a free socket for the debugger Java Basics - Anfänger-Themen 6
J Cannot find Symbol Variable mit JPanels Java Basics - Anfänger-Themen 2
L Fehlermeldung: RealMirror.java cannot find symbol Java Basics - Anfänger-Themen 2
D Cannot Find Symbol Java Basics - Anfänger-Themen 6
M Compile Time Error - cannot find symbol (Objekt!) Java Basics - Anfänger-Themen 2
L Problem mit Vererbung (extends) cannot find symbol Java Basics - Anfänger-Themen 3
S Problem beim Kompilieren - cannot find symbol - constructor() Java Basics - Anfänger-Themen 12
N cannot find symbol URL Java Basics - Anfänger-Themen 2
S Problem mit Javaeditor: Cannot find Symbol Java Basics - Anfänger-Themen 13
P cannot find Symbol - WTF? Java Basics - Anfänger-Themen 4
R can not find symbol Java Basics - Anfänger-Themen 4
StupidAttack cannot find symbol Java Basics - Anfänger-Themen 16
B Cannot find symbol-Fehler Java Basics - Anfänger-Themen 3
Luk10 Cannot find Symbol Daten Java Basics - Anfänger-Themen 10
E cannot find symbol??? Java Basics - Anfänger-Themen 8
B cannot find symbol Java Basics - Anfänger-Themen 11
N cannot find symbol Java Basics - Anfänger-Themen 11
W Cannot find symbole variable Java Basics - Anfänger-Themen 4
T OOP cannot find symbol Java Basics - Anfänger-Themen 4
A cannot find symbol - symbol : method Java Basics - Anfänger-Themen 5
T cannot find symbol Java Basics - Anfänger-Themen 5
V Unable to find an ant file to run Java Basics - Anfänger-Themen 2
I Cannot find Symbol & NullPointerException Java Basics - Anfänger-Themen 8
A cannot find symbol. Java Basics - Anfänger-Themen 5
G cannot find symbol! Java Basics - Anfänger-Themen 22
K Ständige Fehlermeldung "Cannot find symbol" Java Basics - Anfänger-Themen 2
L cannot find symbol-method Java Basics - Anfänger-Themen 3
P Error: Cannot find Symbol Java Basics - Anfänger-Themen 4
G [Hibernate] Could not find a setter for property Java Basics - Anfänger-Themen 2

Ähnliche Java Themen

Neue Themen


Oben