A wise man always listens to his Doctor... paying money and buying JBuilder is likely to be by far the easiest way of building a JAR!
I am not so wise, so had to spend many hours writing .BAT files to do it for me!
Roughly, this is the basic process, with compilation, obfuscation, preverification and JAR/JAD building. You should read all the documentation for the programs involved to make sure you know what this is doing. In the future, you may want to tailor this process.
I've butchered this from the file I use... I do some extra bits that you really don't want to know about!!! Copy this into the directory where your .java files are, then type "make" at a command prompt. I don't place any of my classes in packages; if you do, you may need to change some bits. Please keep in mind that this script is built for the way I work... if you work in a different way, it may be unsuitable.
You'll need to make changes where I've indicated, to configure your file locations and project options.
It would be a good idea to add some extra bits to clean up all the temporary files, either at the start or the end, but I'll leave that to you!!
rem *** set MIDlet parameters for this project
rem --- set these to whatever you want!
rem --- this will build "test.jar" and "test.jad"
rem --- this is the descriptive name for the app
set NAME=Test Application
rem --- this is the main class
rem --- icon file
rem --- version number and vendor name
set VENDOR=I made this
rem --- list of extra files (other than classes)
set RESOURCE_LIST=%ICON% ball.png profile.png table.png
rem *** set paths to JDK, WTK and RetroGuard
rem --- these need setting to where yours are installed
rem *** temporary directories
rem --- we need these to store class files in
if not exist %JAVAC_OUT% md %JAVAC_OUT%
if not exist %RETRO_OUT% md %RETRO_OUT%
if not exist %VERIFY_OUT% md %VERIFY_OUT%
rem *** compile
%JDK_PATH%\bin\javac -bootclasspath "%LIB_PATH%" *.java -d %JAVAC_OUT%
if errorlevel 1 goto END
rem *** obfuscate
rem --- don't change the name of the main class
echo .class %MAIN_CLASS%>mainclass.rgs
rem --- we build a jar first
%JDK_PATH%\bin\jar cvfM temp.jar -C %JAVAC_OUT% .
rem --- then run RetroGuard
%JDK_PATH%\bin\java -cp "%RETRO_PATH%;%EMPTY_LIB_PATH%" RetroGuard temp.jar retro.jar mainclass.rgs rg.log
rem --- the obfuscated jar is then "un-jared"
%JDK_PATH%\bin\jar xvf ..\retro.jar
rem *** delete unwanted files
rem *** preverify the obfuscated classes
rem --- you must preverify AFTER obfuscation
%WTK_PATH%\bin\preverify.exe -classpath %LIB_PATH% -cldc -d %VERIFY_OUT% %RETRO_OUT%
rem *** build manifest file
echo Manifest-Version: 1.0> MANIFEST.MF
echo MIDlet-1: %NAME%, /%ICON%, %MAIN_CLASS%>> MANIFEST.MF
echo MIDlet-Name: %NAME%>> MANIFEST.MF
echo MIDlet-Version: %VERSION%>> MANIFEST.MF
echo MIDlet-Vendor: %VENDOR%>> MANIFEST.MF
echo MicroEdition-Profile: MIDP-1.0>> MANIFEST.MF
echo MicroEdition-Configuration: CLDC-1.0>> MANIFEST.MF
rem *** build JAR
%JDK_PATH%\bin\jar cvfm %FILE_NAME%.jar MANIFEST.MF -C %VERIFY_OUT% . -C . %RESOURCE_LIST%
rem *** build JAD
rem --- this works in Win2000 to find the size of the jar
for %%f in (%FILE_NAME%.jar) do set JARSIZE=%%~zf
echo MIDlet-1: %NAME%, /%ICON%, %MAIN_CLASS%> %FILE_NAME%.jad
echo MIDlet-Name: %NAME%>> %FILE_NAME%.jad
echo MIDlet-Version: %VERSION%>> %FILE_NAME%.jad
echo MIDlet-Vendor: %VENDOR%>> %FILE_NAME%.jad
echo MIDlet-Jar-URL: %FILE_NAME%.jar>> %FILE_NAME%.jad
echo MIDlet-Jar-Size: %JARSIZE%>> %FILE_NAME%.jad
rem *** that's it!