I'm fairly new to Java development, and people have been suggesting I use Eclipse as an IDE for the work I'm doing. My code lives on a linux box (running Ubuntu of some fairly recent version), but I use a MacBook as my main computer. I've been ssh'ing into the linux box to work on the non-Java code, simply using vim and have done the same up to this point with the java code, compiling it from the command line. From what I hear, Eclipse would be fairly useful in managing the project's code, but from all I've found, it seems I need to run it locally with the code; i.e., either with the code on my Mac or Eclipse on the linux box, not with Eclipse on the Mac and the code on the linux box.
Any one else in a similar situation that has a working solution they can explain?
The first thing you should do is set up a revision control system. I recommend SVN. Then install Eclipse on your Mac with the Subclipse plugin so you can check out the code to your local machine and work on it locally. You can deploy the code to your linux box in a number of ways. The simplest might be to simply check out the code from SVN on your Ubuntu box.
You can also write and compile your Java code on your workstation, and then export it and ftp it (as a jar file) up to the host where it will execute as needed. Eclipse also has a remote debugging feature that you can use to look into the remote JVM from your workstation, so you can step through it using the IDE as it runs.
You could install Subversion on your Ubuntu box and connect to it on your MacBook, which has Eclipse installed. You also need to install a Subversion client in your Eclipse (which is an easy thing to do). I'm sure Google will fill in some gaps.
If your bandwidth is big enough and the Linux box can run Eclipse on its own, you can tell the Linux box to use your Mac X11 display.
A frequent way to do this, but a bit slow, is to start X11 and then use "ssh -X linuxbox" (or "ssh -Y linuxbox") to get the X11 forwarding. Test with xdpyinfo, and then just run Eclipse in your ssh'ed in shell.
If you mount the Linux box as a drive on your Mac, you should be able to point Eclipse at the code. I do that at work, where my code resides on a Solaris box, yet I'm running Eclipse (and NetBeans) to edit that code on Windows.
The only catch is that you need network access to that machine.
Another option is to run a remote graphics server like FreeNX on the Linux server, then connect to it from your Mac with the FreeNX client. You can then have Eclipse installed on the Linux server and just use your Mac as a display client, which avoids any syncing problems. NX works pretty well over low-bandwidth connections; a number of the developers at my company use this method to connect to our office servers from home.
From your description it sounds like you're not allowed to store the code locally on your mac. I'm in a similar situation, where my company doesn't allow you to store stuff on your home computer (I have a mac at home, and a Linux and a PC at the office). I've found that Eclipse is responsive enough when you remote desktop or VNC to it, if that's allowed by your company.
If I'm misunderstanding you, then source control is your friend - develop on the mac, check in, and execute on the other machine. Alternatively, you may want to use rsync. I did this thing when I had to develop an Eclipse plugin for multiple platforms and it worked fairly efficiently.
You could try using the Remote System Explorer architecture. I've not used it myself so I can't say how well it works, but this blog describes how to use RSE to browse remote files.
Related
I'm spending a lot of time to look for a Java IDE but I cannot find one that suits my purpose. I normally use Eclipse due to it's multi-language functionality and massive free support. I'm looking for something similar, but it needs to work with SSH.
I'm running Diet Pi on my old Raspberry B+. It's working with Java 11 (32-bit). I'm in need of Pi4J project because I'm going to program embedded in Java. So I need an IDE that can handle SSH text terminal and Maven/Gradle support because I'm to lazy to look up .jar files by my self.
Does anyone know of such an IDE?
Since nobody has responded yet, look for an emacs customized for Java. It's amazingly powerful but I could never get past the complexity myself.
https://www.gnu.org/software/emacs/
http://www.goldsborough.me/emacs,/java/2016/02/24/22-54-16-setting_up_emacs_for_java_development/
It should already be on your RPI or it should be a trivial apt-get.
I'm sure someone will post soon with a better sales pitch.
VI can be a reasonably good code editor as well, but again takes a little customization and a learning curve--but if you are going to use Linux, just go ahead and learn enough vi to edit and save a file anyway, you will need it someday.
Eclipse over ssh (Additional answer):
This isn't the easiest setup in the world, but ssh is one of the most flexible tools in unix. You can have it create a "Pipe" between your computer and the remote computer (Like a VPN). You can then run RDP over this pipe which will let you run any program that is on your RPI.
I'm afraid I haven't done this in quite a while and don't know the options offhand, but googling "RDP over SSH" gave me some good looking answers (Using Putty which will simplify things a lot).
Mount the drive and run eclipse "Locally" (On your desktop)
You should be able to mount your RPI drive on your local system and use Eclipse there. I googled "Mount ssh" and found stuff like:
https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
Which includes Linux and windows solutions.
If you put your entire project directory on the "RPI", then the jar should be built there as well and you can just flip over to the PI to run it.
These Linux tools are SO flexible--there are a hundred solutions to every problem. You just have to pick a direction and go.
I guess I could list some advantages/drawbacks as long as I'm here typing:
console based solutions:
vi is everywhere
You need to learn some anyway.
EMACS is very powerful
Both are annoyingly hard to setup and learn
Running your PI on your desktop via SSH:
Easy setup
Nothing new to learn
Might be slow (IDE running on RPI plus network lag)
Not terribly flexible, it's going to work or it won't.
Mounting your PI drive on your desktop:
Should be pretty straight-forward
Reasonable performance (May slow down saving/rebuilding project)
Finally I guess I should mention yet a fourth solution, build on your desktop and copy (Deploy) to RPI:
This is probably how a "Professional" would do it
Fastest & most reliable solution all around since your IDE is running on your desktop.
Use SCP as part of build to "Deploy" build artifacts to the RPI
You get to use awesome enterprise words like "Deploy" and "Process"
an SCP based Deploy can be built into your Gradle script
Deploy process can auto-unpack/auto-run your target so you never even need to log into the PI
Most flexible solution, you can do anything with tools like SSH and Gradle.
Other hints:
Be sure you are using a private key to log into ssh, NEVER passwords.
Learn SSH options, there are a lot and they are nearly all great.
Once you get rid of passwords you can use ssh to "Send" commands to the PI without manual interaction, this can be really handy to stick things in your gradle script like "start app", "kill app", …
There, that should keep you busy for a while.
Did you try to Visual Studio Code? The official version is 64-bit only, but you can install an older one which is still available in 32-bits version. With additional Java plugins (which it will propose to install if you open a Java project), this is a great tool on Pi!
$ cd /home/pi/
$ wget https://github.com/stevedesmond-ca/vscode-arm/releases/download/1.28.2/vscode-1.28.2.deb
$ sudo apt install ./vscode-1.28.2.deb
To install Maven on Pi:
$ sudo apt install maven
Check the installation by requesting the version:
$ mvn -v
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 13-BellSoft, vendor: BellSoft, runtime: /usr/lib/jvm/bellsoft-java13-arm32-vfp-hflt
Default locale: nl_BE, platform encoding: UTF-8
OS name: "linux", version: "4.19.66-v7l+", arch: "arm", family: "unix"
Here is my setup:
System76 Gallago Pro
Fedora 30
OpenJDK 1.8.0_201 (I did try Oracle as well)
I installed per IBM's instructions, using the installer script from the command line. I went through the installer menu and got to the success screen. I have done this a half dozen times on other machines and with OS upgrades on this same machine.
When I use the super key to find the program it is there; I click on the icon and my box returns to the desktop - but i Access doesn't start.
If I start via the command line using the start script, I get MSGGEN045 - A graphical user interface is not available.
If I run the java program directly
java -Xmx1024m -jar /opt/ibm/iAccessClientSolutions/acsbundle.jar I get the same message as when using the start script.
How can I get past this error? Or,what else can I do to track down what is happening?
I've had two issues when running iACS on Fedora. The first was the OS had a headless JVM installed by default. The second was something to do with sound.
Based on "MSGGEN045 - A graphical user interface is not available", I'd suspect a headless JVM.
HTH
Edit:
I checked for the headless JVM at the direction of IBM support. I don't remember the exact wording, but the name of the installed package was a dead giveaway. A simple "rpm -qa" was all it took.
I don't have anything Fedora specific but it seems that you either didn't install a Java Runtime Environment or just a headless version of it (jre-headless). Install a full JRE and everything should be fine.
You could check this with yum:
yum list installed | grep jre
Fedora is running wayland and not X11. Java doesn't play nice with wayland as of yet. As far as I know there are no plans yet to fix that. This is a good place to start https://www.ibm.com/developerworks/community/forums/html/topic?id=1b366edf-0e70-40d5-8d92-30d401edd97a
I have a Macbook Pro running El Capitan (10.11.6). It doesn't come with Java and the advise I heard is to not install it because it's unsafe (and apparently Oracle bundles the installation with some ask bar tool or adware so I don't want that).
However, is there a way to code in Java without that? When I try to run Java programs from terminal (java foo.java), it tells me I need it. Is it just the browser plugin that's unsafe or should I keep it away from my computer entirely?
You can't, Java programs run in a virtual machine that you need to install (by installing the Java Runtime Environment).
You shouldn't run into any risks just by installing Java in and of itself, as long as you run programs that you know you can trust. If you really want to feel safe, disable the Java plugin from your browser (Actually, I checked and my broswer doesn't have any Java plugin installed, so you don't even need to do that). The toolbar is completely optional, just uncheck the option during installation.
If you want to write Java code you'll have to install the Java SDK too.
I'm really tired of computers not having the necessary Java version I need, or I don't have admin privileges to install it. I've seen tons of windows tutorials, but I'm on a Mac. So can someone tell me how to put Java 7/8 on a flash drive, and how to create a script to run a jar file with the version on my drive I have selected? Thanks! I'm on Mac OS X 10.10
Based on your comment to another answer
I have a computer I can do it on with admin privileges
It sounds like you just want to have the JVM/JDK on some portable media that you can run from after you plug it into another computer. This should be simple assuming you only plan on using it on comparable systems. For example, you won't reliably (or at all) be able to install Mac x64 java binaries on a flash drive and try to run it on a Windows machine.
So assuming you only intend to run it on comparable machines, it's as simple as copying the directory structure from the root of the Java install directory. On my Mac OsX 10.9.5 it's /Library/Java/Home. Once you have it on the drive, you just plug it into another Mac. It should automount and you open up a terminal to the root of that mount. cd into the $JAVACOPY/bin (where $JAVACOPY is the directory structure you copied) and you can run ./java -version to verify you are running it.
If all is well after doing that, you can launch any JAR file from that flash drive mount directory with
cd /Volumes/flashMount/Java/Home/;
./bin/java -jar /Users/myuserid/myJar.jar
Keep in mind that Java doesn't strictly require any of the formal install process that systems like Mac and Windows surround it with. All of the fluff involved with "installing" java is about setting up the system to use whichever Java version is installed without the user having to know or care. But you can have as many versions of java as you want in the file system without "installing" them and they should all function just fine (ignoring classpath collisions for certain libraries.)
I have a web project developed in java. I am using the Windows platform and accessing the project from the Windows machine itself. How can I make the project run on a Linux machine? I am using jboss server and deploying the project.
Regards
Java is Cross-Platform, MySQL also. You can have your application server running on one server and the database on another. You can even have your Appserver on Linux and your database on Windows and your client on MacOS.
If you run into any specific problem, please let us know, but everything should be transparent unless you wrote some very bad Java code ...
Java is a Cross-Platform language. Just deploy your JAR/WAR/EAR in a JBOSS running on a Linux Box.
Java can run on many platforms only if any platform specific coding is not done for example file separator are different in windows, linux and Mac.
You need Jboss for linux and deploy your web application it should just work fine.
Java can run on many plarforms including linux and windows. You can develop project anywhere and run on any server.
I suggest you, install a linux on virtualbox and deploy it on linux directly. Also you can try cruise control for deploy automatically.