Setting a default starting file for Eclipse - java

I am learning to use a programming language based on Java called Processing that's basically a library. While it comes with it's own IDE, I find too minimal and basic, so I wish to use Eclipse instead.
While I have been able to get it to work, it's a whole lot of hassle to import the library everytime I start a new project, and I was wondering if it's possible to set some sort of default starting "skeleton" for Eclipse where everything is already loaded and ready to go.
Thanks in advance!

While you can create an eclipse template, it's worth trying the Proclipsing Processing plugin.
On top of creating Processing projects it makes it easy to manage/import Processing libraries and (hopefully still) generate applications.

Related

Is there a way to use external libraries in IntelliJ without downloading their .jars?

I am trying to write a standalone Java application in IntelliJ using edu.stanford.nlp.trees.GrammaticalStructure. Therefore, I have imported the module:
import edu.stanford.nlp.trees.GrammaticalStructure;
Currently, Intellij doesn't recognize this and many others of the imported external libraries (cannot resolve the symbols) and is also not able to automatically download/import them.
Is there a way to use the GrammaticalStructure class without having to download the entire Stanford CoreNLP .jar and adding it to the project as a library? This question applies to other dependencies as well, since I want to use other external libraries but avoid including their .jar files as much as possible (to minimize the size of the final application, given that it will be standalone). Unfortunately, all the solutions I have found proposed exactly that.
Apologies if I have overlooked some basic setting or setup steps, it has been a while since I have worked with Java.
Any help is greatly appreciated.
If you want to use it means you want to execute the code in them. How is the runtime supposed to execute code that is does not have? How is the compiler supposed to know how the code is defined (e.g. what the classes look like)? This is simply impossible. If you want to use the code you have to provide it to the compiler as well as the runtime.
If you just dont want to include all of that code into your application, you need either access to the sources and just pick the class you need or you need some kind of JAR minimizer as #CrazyCoder suggested.

Is there a way to leave notes in library code in eclipse?

due to reasons I am working with undocumented java library code that I cannot alter in any way or write into. Im using eclipse 2020-06 and I would like to leaves some notes for myself to make things easier. Is there a way to do that? or maybe an eclipse extension?
You can use bookmarks. They work somewhat similarly to breakpoints, without pausing execution when you're debugging.
You can add them via the context menu.
If I recall, you're a bit limited by the amount of information you can add. It's basically just a single text box.
See the help section on bookmarks
Maybe there's some plugins which extend the functionality (e.g. this one for adding keyboard shortcuts)

How do I use MUpdf in an existing java project

Mupdf documentation shows me how to use the library as an application and deploy it. However, I want to suck it into an existing java project and build my application on top of it. Can this be done? If so, how do I bring just the pieces needed, into my project?
Take a look at jMuPdf. I never used it, but it seems to be active.
Otherwise you will need to create Java Native Bindings (JNA or JNI).

How can I use Android with Java and a core made with Scala?

I made a small project using Scala (SBT + IntellijIDEA) that provides me a set of classes and other functions that I want to use in Android. I will call this project $core.
So, keeping that in mind I tried to first only use scala. I tried to create an Android Project using android-plugin and I got it.
But what I really want is to use my $core in an Android Project AND expand the $core classes using Java. $core provides an API that I would like more people to use and they probably don't know Scala so Java would be perfect. Besides, I need to go into a safe route with Android. I saw some info that scala takes a lot of time to compile into Android and has some limitations (like with parceblles).
I already tried to use the classes in eclipse with the import class folder option. I even tried to generate a jar so at least I would have a way to run it and no success. Always the NoClassDef error when I try to use one class from the $core. I have tried to import also the scala compiler library, but didn't work out aswell...
Core isn't finished yet and I would like to develop on a single environment that allowed me to debug on the android device. How can I setup all of this?
PS: Changing to eclipse now maybe is better? Never tried android on intellijIDEA and In scala I can't debug over there, at least using ScalaCheck...
Is it possible that you are getting an noclassdeffound error when working with Scala code from java because you didn't add the Scala library to the java project or at least included the party of it that it's used in the Scala code in the jar?
Could you post the rest of the error?
You could package the core to .jar together with Scala library, use Proguard to remove all unused Scala library classes from it, and then use that jar as a regular library.

Adding Android SDK to an existing Java project?

I'm a fan of a fairly big open-source program which is written in Java and uses Swing as a front-end client on series of web actions. As I've been working with Android development for a few months, I had an idea that I could create a new app that works similarly to the Swing application. The program is well-organized and separates interface from implementation, also offering a command line interface as well as Swing.
So ideally I'd like to be able to just inject a new Android package into the existing file system somewhere, make use of the back end that already exists, and have it work seamlessly with new updates to the program. The closest suggestion I found was this:
Q: How can I create a new project from an existing project, using Android command line tools?
A: Copy the directory tree of the old project into a new project.
This doesn't seem like it can be feasible advice for me, since I have to work with the existing SVN repository rather than starting the whole thing from scratch. Is there any way to pull this off?
since I have to work with the existing SVN repository rather than starting the whole thing from scratch. Is there any way to pull this off?
I doubt it. Android won't like the Swing code; standard Java won't know what to do with the Android code.
I suggest that you reorganize your code base into three:
One generates a JAR file, containing the common logic
One is the rest of your existing Swing/command-line logic, which uses the JAR
One is a new Android project, which also uses the JAR
Maybe you can pull this off by having src-jar/, src-swing/ and src/ (latter for Android) and associated build scripts. Personally, I'd have three totally separate projects.
Since SVN supports move operations (at least, it used to, last I used it, oh so many years ago), you should be able to accomplish this reorganization without losing any version history.

Categories