Adding OCR library causes error in Eclipse - java

I have some trouble adding an OCR library to an existing Eclipse project. I already tried to add the Tess4J and J4L java wrappers for Tesseract-OCR and the Asprise jar-file without success. The problem is each time i want to run an application, eclipse prints javaw usage message (same issue described here: Trouble compiling any java code in Eclipse). I can run application by removing the libraries from the build path, so I'm pretty sure my java-setup is correct. In addition I already tried restarting windows, reinstalling java and eclipse with no success either. I hope somebody has a solution or at least some advice for my problem.

Finally I found a solution. There is some unclear incompatibility between J4L (or Asprise) OCR and H2 Database Engine. Removing H2's .jar file from the build path resolved the issue.

Related

Why is Intellij Idea freezing during indexing?

I'm on Manjaro linux using Intellij Idea community 4:2022.1.3-1 and jdk 17 for this project, maven is also present
Intellij always hangs after it starts indexing the jdk, it's responsive for a period of time but if I type anything or open a new menu after it's begun indexing the jdk it will immediately freeze and I have to kill the process.
This behavior started after I began attempting to use the luaj-jse-3.0.2 library. I got it to successfully start by removing this library once but have been unable to replicate this since.
I have tried -
Reinstalling intellij
Installing a different version
Removing the luaj library (only successful once)
Deleting the .idea folder
Running intellij in strace
Waiting for it to resolve
Several combinations of all of the above at once
I'm really at my wits' end on this, anyone know anything?
project github (this is up to date to the project): https://github.com/MorticiaGrey/CompSim
Apparently maven was having an issue with the jar I imported through intellij as a library. On a new project without maven but with the offending jar and code copied and pasted from the original project it worked fine, I also got it to work by deleting the old project and importing it again from github without building any of the maven stuff and deleting all the maven files
It may have been my fault for configuring something incorrectly somewhere, but I was using the normal method to add a library in intellij so if that's the case whoops I guess

problem installing and compling in JavaFX

I am trying to install JavaFX and in particular just run this application. I've been using Java for a while and I have to compile from console since IntelliJ just won't load in my laptop. Whenever I try compiling with "javac HelloFX.java" I get a lot of errors and in particular error: package javafx.application does not exist. This is what my java folder looks like
Java Folder
I also already set up a path C:\Program Files\Java\javafx-sdk-18.0.1\lib
I really have no clue as to what I am doing wrong, and the solutions I've been able to find seem rather complex, or use IntelliJ tools. Thank you in advance.
Even if IntelliJ does not work for you, you could still use either Maven or Gradle to build your project which would already simplify things a lot. You should also have a look at the official documentation.
https://openjfx.io/openjfx-docs/

Eclipse won't load: failed to find a main class

I am trying to download Eclipse onto my flash drive so that it can support itself if I try to use Eclipse on a computer that does not have a JDK/JRE installed and/or I do not have the permissions to install one.
I am able to download it onto the flash drive and run it fine, but the problem arises when I try to make it self-sufficient by downloading a JDK for Eclipse to use on the drive. I have tried many different solutions (yes, I am aware of the abundance of "why is eclipse telling me it cant find main class" questions), but none of them apply to me. I followed this tutorial in my endeavors, but when I run the batch file it comes up with the standard Failed to find a Main Class in "F:\eclipse\\plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar.
I know the \\ looks a bit out of place, but I know that's not the problem since I've tried editing the eclipse.ini file to fix the path but it gives the same error (just with F:\eclipse\plugins\org.[...].jar instead)
I'd really appreciate any help anyone could give. Thanks!
Eclipse has required Java 8 or newer since the Neon release, in 2016. Update your version of Java.

STS on MacOS Error: Cannot find main class (I've tried every solution I can find)

I'm relatively new to programming. I recently installed Spring Tool Suite (the only option I found for the Mac install was for a 64bit version) for Mac on my system, and after installing I created a test project using a java main class to sys out "hello world" to the console. Everything was going swell until I tried to compile and run the program. The console spat back out at me "Error: Cannot find the main class TestApp" (Test App was the name of my main class). I checked it for errors, found none. I thought originally that the project was bad, so I deleted it and created a new project with a similar name. This project returned the same error.
I did some research and found that occasionally the .metadata file for a workspace can be corrupted, so I tried deleting that file, and reopening an STS workspace from the folder to regenerate it. This didn't work, so I tried creating a new file and starting a workspace there, then importing my test project into the new workspace. This also returned the same error.
So then I thought maybe my build path had been corrupted, so I checked and it was pointing to the correct files. I verified that the compiler is working and compiling the run, as the generated bin folder had a binary file in the project had a file in it. I tried I tried deleting the run config and starting over. Still no luck.
I tried project=> Clean, then re-running, then tried deleting the .bin file and re-running, which compiled and created a new binary file, but still returned the same error in the console.
I tried an uninstall and reinstall of STS, deleted all of the folders for my workspaces, and created new folders.
I tried fiddling around in the project libraries to see if any dependencies were missing, and found nothing.
I tried starting a SpringBoot app to see if maybe running Maven for dependencies would help somehow?
Someone suggested it may be an issue with my machine being older, and sure it's old, but it's fully updated, has an i5 processor, 16 gigs ram, and a full TB of storage. I would be really surprised if that were the issue.
These were all of the solutions that I could find, and I may have tried a few other things that I can't remember (I've been at it for the whole day now).
Does anyone have an idea what may be going on here? I'm at that point where punching the computer seems like a possibility. If it is my machine, I know that using the Eclipse IDE with an STS plugin may be more lightweight, but I've heard that the plugin is also kind of a pain to work with. Currently I've just uninstalled STS again, and may try installing again if I can find a new solution to try.
After some further research I came across a way to reconfigure JRE's. I'm not 100% sure of what I did to fix it, but after a full reinstall and new repo folder, I went to configure JRE's when creating a project and set both options to v1.8 . It's working now!

How do you use a Java project in your Android project in Eclipse?

I'm writing an Android application and there's some Java code in it that's somewhat sophisticated and therefore hard to verify the correctness of in the Android environment. I would like to run this code in a desktop environment where I have more tools with which to examine the output of this code while still using it in my Android application.
My attempted solution is to have three different projects in Eclipse. My Android project and two plain (non-Android) Java projects. One Java project has the sophisticated code that I want to use in Android and the other is a test program that verifies the correctness of the former project. The latter project has already been useful in debugging the former.
However, so far, my attempts to use the Java project in my Android project appears to work in the IDE but when I actually run the Android application, the NoClassDefFoundError exception is thrown whenever I try to access any of the classes. Obviously, that code is not being recompiled into the .dex file but why not?
I could go into detail about what I've done so far but I can't help but think that what I'm doing is a pretty standard and simple thing and there's a plain way of doing it, even though I can't find anyone doing quite what I'm trying. Can someone describe to me how this is done?
Luckily, I found the answer to my own question and I thought I'd share it here to help others in the same situation. It turned out to be very simple...
What I was already doing would have normally worked, which should have been a big clue to me since I have actually done this before, successfully. All you have to do is, under your Android project's Properties > Java Build Path > Projects, add the plain Java project to your "Required projects on the build path" and then under Properties > Java Build Path > Order and Export, check the checkbox of that same project in the "Build class path order and exported entries" list and everything should just work.
From within Eclipse, there's nothing else you need to do to get this setup to work. It's only when you're compiling from the command line that you need to build Java Jars and import them as libraries but I'm not doing that (yet).
Finally, this wasn't working for me because I just happened to be compiling my plain Java project under JDK 1.7 compliance, while my Android project was compiled under JDK 1.6. This is verified by the output on the Console pane, reporting "Dx bad class file magic (cafebabe) or version." This error message goes away when both projects are compiled under the same compliance level and, not coincidentally, the Android program runs properly.
Thank you to everyone who tried to help and I hope this answer is helpful to someone out there!
Would it not work if you made your other plain java project into an Android project and use it to monitor the output on the device?

Categories