Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
Version: Windchill 12.0
Use Case: Need help completing my bash script to compile java files. Currently having issues with windchill class not found exceptions, I believe I need to include the .JAR files into the classpath, but am not sure how to do so.
Description:
Here is what I have written so far, the javac $file command is leading to class not found exceptions since I haven't included the JAR files:
I saw this article that briefly talked about how to do https://www.ptc.com/en/support/article/CS324171
But I am using more than one jar file, probably about 50 in total. Need help figuring out what to do with them.
You might need to setup the Windchill shell environment inside the bash script. I add these 2 following lines to shell scripts that need it:
echo " Setting up the Windchill shell environment"
eval `/opt/ptc/Windchill/Windchill/bin/windchill --java=/opt/ptc/Windchill/Java/bin/java eval`
I added in the line to setup Windchill shell environment, but am still getting class not found exceptions when compiling. I tried adding my jar files to the classpath when compiling, which is when I noticed that each file was separated by a string, when they should have been separated by a colon.
After putting all the the jar file paths into a string variable (separating them by a colon) I'm still getting Windchill class not found errors.
Here's what my jar_files_str variable looks like: (full paths of jar files separated by ':')
Current bash file:
errors still getting compiling:
Hi @loganc
You should add all class to the variable not just jar files.
There is a folder codebase in the Windchill folder, where all the internal classes are.
So you should add the WTHOME\codebase folder to the java class variable
PetrH
I'm close to solving this, but not quite. I was able to add the OOTB classes to my classpath with this: CLASSPATH=/pdmlink/ptc/installers/wc12_codebase/wc12_codebase:/pdmlink/ptc/build/jars/*, the issue is I also need custom classes to be referenced in the classpath as well. I tried setting the classpath /pdmlink/ptc/build/jars:/pdmlink/ptc/installers/wc12_codebase/wc12_codebase:/pdmlink/ptc/installers/custom/customization, with the custom class files being in customization. This did not work. I also tried making a copy of wc12_codebase, and copying the classfiles to there, so classpath=/pdmlink/ptc/installers/wc12_codebase_copy/wc12_codebase:/pdmlink/ptc/build/jars/* This too did not work. RenumberResult.class exists in the custom/customization directory, So I am unsure why the compiler isn't able to recognize this.
Hi @anursingh
It is easier to use IDE to compile the customization where you can see what is really missing..
In your case you have still problem with the path and custom classes that are missing in the definition somehow,.
PetrH
Hi @loganc,
I wanted to follow up with you on your post to see if your question has been answered.
If so, please mark the appropriate reply as the Accepted Solution.
Of course, if you have more to share on your issue, please let the Community know so that we can continue to help you.
Thanks,
Anurag