Bonjour,
j'ai fait mon premier prg an java avec Eclipse. Il fonctionne dans eclipse.
Après avoir modifié PATH (C:\Program Files (x86)\Java\jdk1.7.0_51\bin) et Classpath (.;C:\Program Files (x86)\Java\jre7\lib)
J'ai "compilé" sur ms dos le fichier Mmind2.java avec javac ==> Pas de message spécifique et création d'un .class.
J'ai ensuite essayé de lancer le prg avec java Mmind2 et j'ai eu les messages ci-après. Le programme n'a pa fonctionné !!!
Pourquoi ?
--------------------
C:\Users\ccccccc\workspace\Mastermind\src>java Mmind2
Exception in thread "main" java.lang.UnsupportedClassVersionError: Mmind2 : Unsu
pported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
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)
Could not find the main class: Mmind2. Program will exit.
C:\Users\cccccc\workspace\Mastermind\src>
--------------------
J'ai essayé avec java -cp Mmind2 mais j'ai eu :
--------------------
C:\Users\cccccc\workspace\Mastermind\src>java -cp Mmind2
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
C:\Users\Quément\workspace\Mastermind\src>
Pourriez-vous m'indiquer comment faire tourner mon programe java ? (je suis tout neuf dans la programmation java).
Merci d'avance
========
Quelques données
PC sous Windows 7
Partager