Java Specialized IDE: Project files vs project zip/jar [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm creating a specialized IDE in Java and I need to store and use resources associated with the current project being worked on. Should I store my whole project as one file (an archive), or as a system of files? I would prefer to use an archive (duh, one file.), but I'm unfamiliar with the APIs, and I'm not sure how slow that might be. Would it be terribly slower to read images and various other resources from an archive rather that the raw file system?
For example:
User clicks on an image in a jtree
Image is loaded from the file system to an editor
vs
...
Image is loaded from a jar to an editor

If the user is likely to be saving their individual project files, then using a filesystem rather than an archive will be a lot faster since the whole archive doesn't need to be written, only the changed files.
If possible you should only read the files once at the time the project is loaded into the editor, and after that have it all in memory. This is a lot faster than reading from the filesystem all the time.
So in summary, it's not the reading but the writing that would be the bottleneck with an archive.
On the other hand it also depends on how much data we are talking about.

Related

Is it possible run files in JAR file using Java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I want add a file into the jar package but this is a separate file from the java program, can I run it and if I can run it, how can I run it? Can you recomment anything?
Thanks.
Not possible; java doesn't run arbitrary executables; your OS does. Java ask your OS to run an executable, but OSes generally do not have the ability to run executables from within zip files. Let alone jmod files.
If your java application can read and process the data itself (example: Render a swing JLabel object with some PNG as its image), then you can to this:
YourClass.class.getResource("open_url.png")
Will get you an inputstream for the stated file, as long as that file is in the same place that YourClass.class is - even if it is in a jar file or jmod file.
However, if you have an .exe, you'd have to extract the executable, save it to a tmp dir, and then ask the OS to run that file. Saving executables to temp dirs is a little tricky (if it's a global temp dir, some other user could overwrite your executable in the middle, and thus run its code in your process, you see how that's security-wise quite a big issue). But, you can do it. Note that this makes your app not platform independent anymore, of course.

Java program file output upload to Squarespace site [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
In summary I have a java program that writes a file and I would like to now take that file and upload it to my Squarespace website. From here I am trying to figure out what my next steps are.
Unfortunately, Squarespace currently only offers APIs related to commerce (inventory, orders, products, transactions) and forms. There is no file storage-related API.
The only ways to upload files are via the WYSIWYG editor (via the add-link button), via the CSS Editor (for image assets) and via developer mode.
Squarespace 7.0 sites (current sites are 7.1 by default) that have Developer Mode enabled do support Git and SFTP. Theoretically, one could develop a system that utilized one of those methods in order to add files to the site (which would then be accessible via /assets), but that is only theoretical and far from ideal.
I'm afraid there isn't a good method for automatically uploading files to a Squarespace site.

How do I start Java app or communicate with existing Java process on specific file extension opening? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
This occurs with many applications, for example Microsoft Word. If I click on a word file (.doc). Microsoft Word will start or communicate with an already running process.
How do I implement this with Java? Of course with my own file extension.
A file with the custom extension would just be a json/xml text document. But obviously the custom extension part is needed so windows knows what to open it with.
Eventually it would open a new screen/page in an javaFX application.
I am not sure what to call this, and I am having trouble finding examples because of that.
This involves setting file associations in the OS your java application is running in.
Oracle provides a tutorial (pretty old at this point, it mentions it was written for 8) which is about creating self-contained application packages which bundle the code and runtime together. This has a section on Using File Associations.
When creating your bundle, you can set file associations which the installer will setup in the OS.
<fx:info title="File Association Demo"
vendor="MySamples"
description="A Demo of File Associations for Java Packager"
category="Demos"
license="3 Clause BSD">
<fx:association extension="js" mimetype="text/javascript" description="JavaScript Source"/>
<fx:association extension="groovy" mimetype="text/x-groovy" description="Groovy Source"/>
</fx:info>

Store files directly into database or into project path [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to know what is the best way to store uploaded file.
Is there any performance related issues and benefits between storing in these two ways: (storing in DB and storing in project path)
Which kind of risks can be occurred in each way when retrieving files?
If volume of files (the overall storage that you need) is not high better to use DB. But if there are a lot of large files that need to be uploaded, better to use filesystem.
In case of DB, pros:
All data is in one place so you can easily read all you need from a single place.
DB level permissions can be applied to stored files too.
You can parse/process file contents using DB level procedures.
You can use full-text search of the DB system.
Backup/resore of data will be easier because everything is in DB.
cons:
In case of larger volume of data, storage/retrieval of data will take a lot of time.
For filesystem, pros:
You can handle larger storages.
Cons:
Opposite of all cons of storing data in the database, especially the backup/restore process will be much more difficult and complex.

Android Build process: using aapt on Resource files? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am unsure about the following information from this link that details the Android Build Process.
I am basically wondering why the resource files need to be cnverted to Java source files (first step), then also packaged up to a .ap_ file?
What is the difference between the two steps?
why the resource files need to be cnverted to Java source files
They are not being "cnverted to Java source files". A Java source file -- R.java -- is built using the data from the resources, and that file represents a listing of all of the available resources. This file provides constants for Android app developers to use to refer to these resources from the rest of their Java code.
To draw an analogy, the Web is not "cnverted" to Google's search engine; Google's search engine represents an index of the Web. Similarly, resources are not "cnverted to Java source files" like R.java; R.java represents an index of the resources.

Categories