0

I am experimenting with OPCAT for simple systems egnineering models. I know that there is a newer cloud version, but it does not allow sharing and saving models, so I stick with the old OPCAT.

It is a java-application and on a windows machine it runs using

java -Xmx1024m -Dopcat.home="%APPDATA%\Opcat" -Dopcat.source="C:\Program Files (x86)\Opcat\Opcat.Structure" -jar "C:\Program Files (x86)\Opcat\Opcat2.jar"

following that logic I converted the terminal input to

java -Xmx1024m -Dopcat.home="/home/dh/opcat" -Dopcat.source="/home/dh/opcat/Opcat.Structure" -jar ~/opcat/Opcat2.jar

unfortunately I get errors (selection, actual output much longer):

log4j:ERROR setFile(null,true) call failed. java.io.FileNotFoundException: opcat-log.xml Exception in thread "main" java.lang.NoClassDefFoundError: sun/misc/BASE64Decoder

I tried java-15-openjdk and java-16-jdk, the result was alwayas the same. Websearching the problem resulted in me setting different CLASSPATHs, with no effect.

There are many texts out there leading down the rabbit hole of java developing, but I simply do not have the capacity to dig into them. I really hope I get a simple solution for the problem, since I am process engineer and nowhere close to a software developer (which I regret alot).

I am using manjaro linux, the OPCAT jar-file can be found here: http://esml.iem.technion.ac.il/opcat-installation/ (very last bullet point). I tried the "How to Install OPCAT on MAC"-help file, but was not lucky.

I don't know what to expect here, maybe you can point out the right direction. Thanks..

nift.d
  • 13
  • 4
  • 1
    You should try with Java 8. sun.misc.BASE64Decoder was probably removed for deprecation: https://stackoverflow.com/questions/62193303/java-11-patch-sun-misc-base64encoder – NoDataFound Jun 20 '21 at 10:58
  • Have you talked with the support of OPCAT about the problem of their software? The class `sun.misc.BASE64Decoder` shouldn't be used anyway, see https://stackoverflow.com/questions/5549464/import-sun-misc-base64encoder-results-in-error-compiled-in-eclipse and https://www.oracle.com/java/technologies/faq-sun-packages.html – Progman Jun 20 '21 at 11:00
  • yes, I talked to the support. since introducing OPCLOUD they killed support for OPCAT, so there is no help. there is no more active development for OPCAT. – nift.d Jun 20 '21 at 11:05
  • is it possible to have the default java version set do java 15 and run an app with java 8? how do i do this? – nift.d Jun 20 '21 at 11:12

1 Answers1

0

You have an old version of OPCAT which was developed with an old version of Java. Oracle removed the class sun.misc.BASE64Decoder with Java 9, so you need Java 8 to run it.

I highly recommend using SDKMAN to manage different versions of SDKs on your system.

McPringle
  • 1,939
  • 2
  • 16
  • 19
  • thx, unfortunately I could not find SDKMAN in the repos. on the windows machine I use the current java version. How is this not a problem there? – nift.d Jun 20 '21 at 11:18
  • SDKMAN is not in any repo, it is just a shell script. On Windows, it should have the same problem. If not, either you are using Java 8 or earlier, or you have a library with that class on your classpath, or OPCAT brings its own Java. – McPringle Jun 20 '21 at 11:21
  • this is where my lag of java knowlege gets in the way. OPCAT does have a 'lib' directory. can I expect that the missing classes are in there, but are somehow not found? or is it a problem of the java framework (sorry for the unfit wording)? I tried to set the classpath to the lib-directory of OPCAT, the errors did not change – nift.d Jun 20 '21 at 11:29
  • If OPCAT does not support Java 16 but Java 8, you should run it with Java 8. I do not recommend patching around if you are not familiar with Java. – McPringle Jun 20 '21 at 13:18
  • ok, I used $ sudo archlinux-java set java-8-openjdk/jre to change the default jre and it worked. I thought, I tried that before, but obviously I did not. Thx – nift.d Jun 20 '21 at 14:31
  • ran it using: java -Xmx1024m -Dopcat.home=/home/dh/opcat -Dopcat.source=/home/dh/opcat/Opcat.Structure -jar ~/opcat/Opcat2.jar small follow up question: how can I detach the java program from the terminal session? – nift.d Jun 20 '21 at 14:40
  • Simply add an "&" at the end of the command to start it in the background. – McPringle Jun 21 '21 at 13:14