I'm trying to compile some java files on my computer under Windows 7 in french; and I thing I have some trouble with file endoding...
In a first step, I'm generating a list of the file to compile:
dir src\*.java /B/S > javasrc.tmp~
Which will wrote in the file "javasrc.tmp~" line by line the full path of java file (recursivly) of the directory src. In my case I have :
C:\Users\Alexandre\Développement\Java\src\testA.java
C:\Users\Alexandre\Développement\Java\src\testB.java
[...]
(Note that there is an accentued letter into my full path)
In a second step, I compile all the source file with the following command:
"%JAVA_HOME%\bin\javac.exe" @javasrc.tmp~
And I get this error:
javac: file not found: C:\Users\Alexandre\Développement\Java\src\testA.java
When opening my javasrc.tmp~ file in Notepad++ the file is displayed as:
C:\Users\Alexandre\D,veloppement\Java\src\testA.java
C:\Users\Alexandre\D,veloppement\Java\src\testB.java
[...]
The accentued letter is display as a comma; and I have to select OEM 863 file encoding to display the content of the file correctly.
So how to solve my problem? (I'm using these commands as an automated process in a bat file).
Thank you.
The best way would be to change to ant or maven, instead of bat files. It's more standard and also more portable.
A basic ant file would be named build.xml and look something like this:
<project name="My Project Name Here" basedir="." default="main">
<property name="lib.dir" value="lib"/>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<property name="main-class" value="My Main Class Name Here"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="compile">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.dir}"/>
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<classpath>
<path refid="classpath"/>
<path location="${jar.dir}/${ant.project.name}.jar"/>
</classpath>
<arg value="RIMM" />
</java>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.