Javafx SceneBuilder not shareable or derby not connecting in .exe - java

So I am a new programmer in my second term of Java programming. The term is over, but some of us students turned in our final projects only to find out when we gave over our projects some of the .jar files do not seem to follow the project.
We did all of our work in Netbeans because these were the rules and when using SceneBuilder things went wonky.
The solutions I'm looking for are:
How can I share this project with my teacher and have it work on a different machine than mine, (I did make this into a .exe file and .jar file, not a complete solution).
If number 1 can't be done, how do I get my derby database to work in the .exe file?
When the .exe file executes the GUI pops up and I have full functionality as I would when running in Netbeans. Cool right? Ehh. Only problem is the derby database does not get built as it should. Then the select statements do not get called, because there is no DB to connect to.
Any help would be amazing and if a solution for sharing the non .exe in Netbeans can work I think it will help my instructor also.

If your are using derby in an Make sure you have derby.jar in your class path. Am assuming you are using derby in an embedded environment if not please clarify. Make sure you connection path points to the location of your database

Related

JavaFX How to deploy an application and make my resource available in code?

I have written an JavaFX application to study German language with a Flashcard like program. It turned out my classmate also want this but I don't know how to deploy it.
I have a sqlite database which store some german words and I need read/write access. I have tried hardcode the path but it obviously is not good. I have tried to load the sqlite file by the following line and deploy it as a runnable jar but I couldn't write on it.
"jdbc:sqlite::resource:Vokabeln.sqlite"
Assume that I don't want to make remote web application, how should I make this file available to my code, and is platform independent? Should I make a installer program so that I ask the user what is the path? I also don't know how to write an installer application. I googled and didn't find anything like that.
You'll want to distribute your application with the database as a file outside of the Jar because otherwise you won't be able to have write access to it.
If the database file is on the same directory/folder as the Jar file, you should be able to connect to it with a JDBC URL like the following: jdbc:sqlite:sample.db
Distributing your application as a Zip file is fine, but if you can't expect end users to have Java installed and so, there are programs to create installers, even cross-platform, such as IzPack and Install4J

How to avoid installing the configuration files of a swing application in every computer in the network?

I have a swing application that is installed in the server, and to access it, I have created a short-cut in every computer in the network, and it's working just fine. The application uses jrxml files to generate documents, and they are packaged in a folder called Cycloplan and its working fine, but I still have some technical issues, in which every time I make some updates in the configuration files, I have to go to every computer and paste the Cycloplan folder to it, so I am looking for a method to avoid this operation when an update shows up. please help.
Package the .jrxml files into Jars and deploy the lot using Java Web Start. They will be updated automatically when the Jar is updated.

Control NetBeans Programmatically using a NetBeans Module

I know I should probably be using Eclipse but whatever...
Usualy at computer science contests I go to, we are given some sample data sets for the problems, such as "prob01.in, PizzaProblem.text, ect.". I am writing a NetBeans Module to make a project and then fill the project with java files of the input files, in the specified location.
So, on to my question. Is there any way to "control" NetBeans, and use it to make and open projects and files?
I did a breif google search and did not find anything useful.
Thanks,
-EpicDavi
http://wiki.netbeans.org/OpenProjectsProgramaticallyInNetBeansIDE#Tutorial_.7C_Open_Projects_Programatically_in_NetBeans
This page only tells you how to open a project programmatically in a Netbeans module, but it should set you on the right path. Unfortunately, I'm not well versed in NetBeans so I don't have much other insight to offer.

Java Netbeans: Editing the MySQL DB connection infos

I just created a new project with NetBeans using the database template to connect to a MySQL database. After searching a while I got a question and hope anyone can help me with that:
I want to create a dialog in my application to change the connection-informations to the MySQL Server. I realized that the template gets the infos out of the persistence.xml file when it compiles. But I cant find the point in the source code where he reads the xml file and gets the informations. Is there any way to hardcode the IP adress and the Database name and so on in the code?
Thanks for your help!
Don't use the Swing Application Framework.
Newer NetBeans IDEs will display this disclaimer if you create a JavaDesktopApplication project:
Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned. You can still use the Swing Application Framework library as it is, but no further development is expected.
If you are looking for a Swing-based application framework, consider using the NetBeans Platform [platform.netbeans.org][1], which is a full-featured platform suitable for creating complex and scalable desktop applications. The Platform contains APIs that simplify the handling of windows, actions, files, and many other typical application elements.
As to your question regarding the persistance.xml file, that's read somewhere in the framework (probably in org.jdesktop.application.Application). It's not in any of the files in your project. All you can really do is change the values in the file.

How to avoid no main class and no class def found error using DropBox and Eclipse for Java

I use Eclipse to write Java code and use DropBox to sync my code with others' across our multiple computers. Most of the time, everything works as expected: if anyone makes a change on either end, the change is saved and when the other person refreshes the Eclipse workspace, the changes come through and can be viewed and run successfully.
Sometimes, one of several errors arises. Sometimes Eclipse says it cannot find a main class and sometimes it says it could not find the class itself. Sometimes it will not report an error but for some reason will not actually update the .class file and therefore run an old version even though the compiler displays the new source code and that saves. I've then noticed that if I manually copy the code into a new .java file elsewhere in the file system and then compile it, it works fine, but for some reason it refuses to regenerate the .class file and I have to delete it manually and replace it with the one generated in the other project--then it works. But for solving the other problems everything needs to be manually copied, deleted, and re-pasted....
[The actual errors include NoClassDefFoundError, UnsupportedClassVersionError, and some other error related to not having a main class.]
I realize that the description here is somewhat vague, but unfortunately I'm not entirely sure what's going on. I hope I'm just missing some basic fact that would help solve all these problems.
Thanks!
I'm sure you will see issues using Dropbox for sharing your source.
Eclipse does not know what Dropbox is doing whilst it's uploading and downloading updates and their activities will certainly not be synchronised. At arbitrary points in time when Eclipse tries to do builds etc. it will find unexpected activity going on, maybe even partially downloaded source files which might explain the specific errors you are seeing.
You're trying to do something more complex than sharing photos or documents. The advice I would give is to use a source control system like git or subversion for source code sharing and control. You can then make use of plugins for Eclipse that are designed to integrate these systems in an easy to use way. There's a learning curve there, but the skills will serve you well.
You can use online versions of these solutions like github and unfuddle if you want to consume sharing, backup and version control of source as a service like you do with Dropbox. They're free, too.
Subversion, Git and all version control software solve all of these problems for you.
Dropbox is not really an adapted system for sharing code. What you should do is set up a SVN, and commit only the source files. This way, you won't have these kind of errors.
Dropbox does have versioning (you can restore old versions of a file), and doesn't seem to be a horrible solution for the problem. I keep my Eclipse repository on Dropbox so it is available on any computer; but since I only use it myself, I haven't encountered your problems.
There is one case I can absolutely see you running into problems--it's if your class files are stored in the dropbox as well. This would just screw everything up. Make sure you specify a location on your local hard-drive for all build artifacts (classes, jars, ...) and that the only thing on your dropbox is the .java sources.
In fact, I suggest you don't keep your eclipse project in your dropbox, just create your eclipse project and point it to the java files in your dropbox.
If this doesn't work for you, go with what other people here said and set up a SVN repository somewhere, it's easier than you would think.
Oh, another possible problem--dates! You may want to make sure the date on your java files isn't jumping forwards and backwards (as might happen if one of your developers were in another time zone). In this case, Eclipse may prefer not to re-compile your file.
Also, instead of the copy/etc procedure you are currently going through, try forcing a project clean.
Response to request for more info:
When you start Eclipse, select/create a workspace that is NOT on your dropbox. The best place is probably off your home directory. If you have already specified a default workspace, there should be a switch workspace item in the file menu.
Create your project. select "Create project from existing source" and specify the source files in your dropbox. I think you want "create separate folders for source and class files" to keep your class files out of your dropbox. If you see anything saying "Copy files into your workspace, say "no".
This should give you a valid, working project. I hope you don't see those problems any more.
One more thing may help--and this may work on your existing project--without the above procedure...
Whenever you refresh your files (f5) to load in changes from the dropbox, select the Project/clean menu and select the project. This should delete all the class files and rebuild them.
If your classfiles are shared on the dropbox, this could still have strange consequences on other people with eclipse open, so I really do suggest rebuilding your workspace as I said above.
How to avoid no main class
Provide one. That issue has nothing to do with DropBox

Categories

Resources