Distributing jar files properly - file

So I compiled my project as a .jar in NetBeans. The jar file runs flawlessly when running on any machine with NetBeans installed, but refuses to run on a NetBeans-free machine. I'm writing this software to distribute to people that probably aren't Java programmers so this is an issue. I read that I might need to convert it to an exe file? If so how do I make one? And if thats not the solution what is?I just couldn't find something that explained this well enough, so I thought I should post it here. Thanks!

How are you trying to run the application?
To run a jar you need to type "java -jar [myfilename.jar]". You can, of cozurse, make a .bat file to do this for the user.

Related

What to install and how to run an executable file on Mac?

So I'm in terminal, and have a directory called CAPTURE on my desktop, I'm trying to run a program called 'testme'. I read that you need to have build-essential installed but I think that's only on Linux systems and I'm on a Mac so it wasn't necessary because it's already built in (I think). So, I navigated from ~ with:
cd Desktop/CAPTURE
Then, I tried running a bunch of different commands that I found while looking on the internet:
./testme
which returned zsh: exec format error: ./testme
xcode-select --install
which installed properly and I thought I could run the ./testme command but I got the same error as before. Then I tried navigating to the directory again and used
chmod +x ./testme
./testme
which also did not work. I've never run executables before so I really have no familiarity with these commands so they might be super wrong. If anyone can help me run the file properly, that would be much appreciated.
Since your question is tagged as C and Clang, and you are talking about build-essential, I will assume that you are attempting to build an application from source code.
Instead of build-essential, in macOS, you need Xcode. The Xcode CLI tools will work if the application is text-only or Curses, but you will need the entire Xcode IDE for any graphical application.
If running ./testme is telling you Executable format error is probably because it's a prebuilt executable, very likely a Linux ELF executable that will not run in macOS.
My suggestion is to try to build the software. Most C applications will build if you run make inside the directory. make is installed by default by Xcode. Other applications may need a third-party build system, such as CMake, but I do not know if that's the case.

C library problems installing

I am a beginner C programmer, and recently I have run into a problem that I was unable to solve.
I am struggling to install and use a C library. The message error is:
My OS is Mac OS X and im try install the file with ".command" format.
Can someone help me install this library?
Thanks in advance.
More than help installing the library, you need help in understanding what's going on.
Someone gave you a command to run and you ran it, but they were assuming that you were using a different OS, like Ubuntu.
The first message "apt-get not found" is because you're running MacOS, which doesn't have an "apt-get" command.
The second error is because you also don't have wget.
The rest of the messages indicate a poorly written script file, since it blew up twice and still went on to truncate files and do other things.
While you're not going to be able to install apt-get, you might be able to find a compatible version of wget. If not, you can download whatever it was trying to get using your browser, since wget is typically used to automate web HTTP/HTTPS requests.
Without seeing the file, I don't know what the rest if the script was trying to do, but if you read it you should be able to figure out what it was doing, and do it manually.
An easier way to do all this is to install Virtualbox on your mac and run a copy of Ubuntu inside a virtual machine. Then you can run your class assignments without needing to rewrite them all.

"File" command error - how to update magic file

I have been using the "file" command in terminal (Mac) for a while.
Now encountering this error:
file: File 5.31 supports only version 14 magic files. `/usr/share/file/magic.mgc' is version 13
Seems like a fairly simple solution to update the magic file, but can't find any instructions to complete this. Can someone advise?
Any help is much appreciated here.
Perhaps you have more than one file executable in your $PATH. It can get confused if it finds a different database (magic) than it expected. File 5.29 (tagged October 2016) bumped the format to version 14. File 5.31 appears to be the current version on MacOS (works for me).
The "magic" file is built up from many smaller files (see git repository (mirror)). If you needed a specific version that's not prepackaged, you could download the source and compile it, starting with the project page, which points to an ftp site.
However, replacing that magic.mgc file runs into Apple's "system protection" (limited permissions). It's possible to turn that off (perhaps not a Good Idea®) But it's doable.
While you could replace the data file, it might be simpler to just install MacPorts and use the file package from that. It's currently at 5.32 (a step ahead of Apple's package), and if you did not like that, it's simpler to remove/alter.

How to install JudyArrays (C library) on Windows

I know it can sound as a pretty dumb question, but I do not have a great experience with installing downloaded libraries...
Anyhow I downloaded the source code of JudyArrays (which is a C library for a 256-trie for those who doesn't know it) from sourceforge and the installation instructions refers to the make command. I tried to download this utility, but I can't get it work. Which is the correct target makefile? All I managed to get was:
"..path\Makefile.in":15: *** missing separator. Stop.
I tried googling for some help but didn't find anything, either I'm searching with the wrong query string or I'm the only dumb person in the whole planet that can't manage to install it...
Any help? Is there any simpler method?
Thanks everyone
Run your Visual Studio Command Prompt to get a cmd.exe with the proper paths set. cd into the src directory of the JudyArrays source code and run build.bat. This'll compile Judy and produce a .lib and a .dll and a Judy.h header file file you'll have to use in your projects as any other 3. party library.

From nmake: "no rule to make target `*.rc'"

I am in the process of trying to build putty tray, a variant of putty, from source on a Windows 7 system. I need to build it, not just download it, because I need to implement some additional functionality. I'm using nmake and (shouldn't be relevant) the Microsoft C++ compiler. To be precise, I'm working in a cmd window, I'm in the WINDOWS folder of the putty sources, and I'm running the command nmake -f MAKEFILE.VC.
C sources are compiling correctly, but then I'm running into an error that I don't understand:
no rule to make target `*.rc' needed by `pageant.res'
I understand perfectly well what it would mean if it said it couldn't make a particular file: it would mean the file was missing. But I don't get how this makes sense with a wild card.
The presumably relevant part of MAKEFILE.VC is
pageant.res: *.c *.h *.rc ..\windows\pageant.rc ..\windows\rcstuff.h \
..\windows\pageant.ico ..\windows\pageants.ico \
..\windows\version.rc2 ..\windows\pageant.mft
rc $(RCFL) -r $(RCFLAGS) ..\windows\pageant.rc
And, yes, there are *.rc files in the folder: PAGEANT.RC, PLINK.RC, PSCP.RC, PSFTP.RC, PUTTY.RC, PUTTYTEL.RC
Any ideas?
Have you considered trying gmake instead of nmake?
Much of the makefile-driven open source project world finds nmake too limiting and has standardized on the Gnu's gmake as a much better tool. I haven't checked to be sure, but this has the feel of an nmake limitation and PuTTY is certainly the sort of project that would use gmake.
A good place to find a native Windows build of gmake is at the GnuWin32 project. Check out the other packages available there. They are a good source of native Windows builds of a lot of the familiar and useful Gnu tools. They have an advantage over projects like Cygwin that their tools work at the normal CMD prompt, and don't require installation beyond having their bin folder in your PATH, which their nice Windows installer will take care of for you.

Resources