IntelliJ IDEA + Vagrant: compile and run in VM environment - java

I have to use a Java library that has a lot of bugs on Mac OS X and I can't stop using it. I set up a VM (Ubuntu 13) and set up my development environment there, and that works. But is it possible to be able to keep developing on Mac and set-up IntelliJ IDEA 13.1 to compile -> run my project in a Vagrant environment? I could not find any tutorials with how to do that, and not even sure if that's possible.

you can continue working on mac/intelliJ to edit and compile your project files, to run it, it will depend what you are using.
To synchronize the files between your os and the vm, you should set up a vagrant sync the folder between the 2 machines.
Lets say you run your project on mac under /Users/name/project/myproject this project is setup on intelliJ so you can run from intelliJ and compile from there. add this to your Vagrantfile
config.vm.synced_folder "/Users/name/project/myproject", "/project"
It will create a /project directory in your vm.
To run your project, it really depends on your running configuration. For example you can configure a Tomcat remote Run configuration in IntelliJ so if you configure your vm information, it can manage your remote Tomcat installed on your vm. Synchronize your project folder with your Tomcat Webapps (sync_folder or symlink) and it should work.

Related

Running JavaFX Application on another machine

I'm trying to distribute a JavaFX application.
As an example project I took the JavaFX and NetBeans -> Non-modular with Maven. The code can be found here: GitHub: openjfx/samples.
On my machine this application works. But when I try to run that JAR on another machine, it says:
Error: JavaFX runtime components are missing, and are required to run this application
In the section Non-modular with Maven, that problem is being addressed. As a solution it suggests:
Properties -> Libraries -> Run -> Modulepath -> + -> Add Library and add the JavaFX12
But my project properties look different. They are missing Libraries:
Both machines run on Ubuntu and Java 11.
In my case, I work with windows systems, but I think that it's similiar on linux. the problem is that openjdk and javafx no always are available on other computers and dont are included on .jar.
When I want use my app on a other computer, I must build an installer this content:
myapp.jar
openjdk library folder
javafxsdk library folder
And on shortcut I indicate the runs commands calling all modules that I use on my app:
--module-path="../../javafx-sdk-11.0.1/lib/" --add-modules="javafx.web" --add-modules="javafx.controls" --add-modules="javafx.fxml" --add-modules="javafx.base" -jar ../../myapp.jar
In your case, maybe you only needs create a shortcut with commands and indicate correctly the routes of your .jar, openjdk and javafxsdk and, of course, download them on the computer that runs your app.

Spring circular dependencies only on linux build

I have a problem with a spring boot app (1.4.1) and I have no clue what is happen:
The app failed to start due to a "circular dependency" error, but this only happens, when I package the app on our CI server (Ubuntu).
We tried following stuff so far:
Running via IntelliJ and Maven on Windows is working
Running package on the Windows machine and then execute the war is working on Windows and Linux.
Running package on the Linux CI machine and then execute the war is not working on windows and not on Linux.
tried all profiles and there is no difference - so this does not affect anything
same versions of JDK and Maven on CI and Windows machine
Similar problems only say that running on windows works, but not on linux, which (mostly) happens, because the ordering of "resolve and list resource-files" is system-dependent and therefore the ordering of dependency loading is different.
But this would indicate that the packaged version from the CI-system should run on Windows (or the packages version from windows should not run on linux). But it does not!
Since we have no other ideas: what can we investigate?

Setting the JVM to use with Ant when using the command line

I have to build a project using Ant from the command line. It is an EAR to be deployed on weblogic 8.1 and as such the classpath is set on the correct jrockit, shipped with the 8.1 server. However, the tool keeps using the jre7 (also installed on my machine), going as far as not even starting if i uninstall the jre7 and leading to problems such as "Cannot find class Object", and so on.
Before running ant, I run the %WEBLOGIC_HOME%/server/bin/setWLSenv.cmd file in the same console session. Both %WEBLOGIC_HOME% and %JAVA_HOME% are correctly set. The jre7, as far as I know, is not referenced in any environment variable nor in any of the build files. I am not permitted to modify the build.xml file, also I can't use Eclipse or any other GUI to build the project.
So, how can I persuade ant to use the correct JVM?

how to solve a groovy/grails tool suite reference?

I've been working on my desktop computer which has openjdk 7.
When I copy a Grails project onto my laptop, which has Oracle's JDK v7, I'm having a problem with the classpath.
I've checked the classpath and everything seems fine.
Here's the text that GGTS shows:
The archive: /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar which is
referenced by the classpath, does not exist
I set the JAVA_HOME inside /etc/profile.
I installed gvm in order to make easier Groovy and Grails setup.
I hope you could help me
:)
I then went to the RUN menu option at the top and selected run configuration
It was on : Grails \ {Myproject} (run-app)
On the right for this run-app there is JRE options
under JRE ensure you have the same JRE defined as project in this case 1.6
I'm guessing that your JRE reference in your project is bad. Is your desktop windows and your laptop a mac or linux (or vice versa)?
Try these things:
Does the /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar path exist on the broken system?
Can you create other kinds of projects on the broken system?
Can you create a new Grails project from scratch inside of the broken GGTS?
What happens if you run Grails -> Refresh dependencies on the project?

Eclipse, java and dotCMS logging issue

I've been assigned the task of tracking down why a webpage is breaking under dotCMS. The page shows an error stack trace with a description that suggests it relates to SQL. I got access to the remote file system and was able to pull up the java file. The sql it is generating is failing when passed to a getResults method. I was wanting to see the value of that string of sql.
Maybe I could create a text file with that value through java. The previous programmer (that left the business) told me that I would need to shut down the server, clean plugins, deploy plugins and re-start the server so the source could be recompiled into jar files. I don't know how to do any of that at this point...and I wonder if those measures should only be taken when I'm deploying the fix.
I know Eclipse has logging abilities because I've dabbled with Android. I didn't know if there is a way that I could somehow remotely connect to the file. I found a tutorial for setting up eclipse with dotcms. It however wants me to check out the official dotcms source to my machine. I guess I don't understand how remote connections work with eclipse and if eclipse could even help with this issue. Noob question for sure!
When you want to run dotCMS from within eclipse it is not that hard. Remember that dotCMS is just tomcat with a default host deployed in it (the dotCMS application). You can download the dotCMS source here: http://dotcms.com/downloads/index.dot. Startup eclipse and add a tomcat server ( It is tomcat 6.0.26 at this moment), pointing the tomcat folder to the tomcat directory in the dotCMS install folder. You can start tomcat from eclipse this way.
You will have to deploy the plugins if you need to debug those. Below I describe it in detail, but dotCMS has a page on this on their official site as well: http://dotcms.com/plugins/plugin-faq.dot#HowInstall
Make sure you have access to the server that dotCMS is deployed on. On windows that would mean a remote desktop, and on linux you'll need ssh. If you have it running in eclipse on your local system then of course you're set already.
After logging in on the server make sure you have apache ant installed on your system. You can check if you have it by typing "ant -version" on the command line (in a dos box on windows). If you have it installed you'll see something like this:
Apache Ant version 1.8.0 compiled on March 11 2010
if you don't have it installed you can download it here: http://ant.apache.org/bindownload.cgi
install ant and make sure you put the /bin folder on the PATH, so you will be able to call ant from all directories
Now check if you have a JAVA jdk installed. You will need a jdk and not only a jre, because building the plugins includes compiling java files into classes. You can check if you have the jdk installed by typing "javac" on the command line. If you don't have it, install the latest java jdk from here : http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u3-download-1501626.html
install the jdk and make sure the /bin folder os on the PATH
Now stop dotCMS
Go to the root of the dotCMS folder and undeploy the plugins using this command:
ant undeploy-plugins
Now build the plugins
ant build-plugins.
And finally deploy them
ant deploy-plugins
Your plugins are redeployed now. You can restart dotCMS.

Categories

Resources