Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:40:03+00:00 2026-06-15T08:40:03+00:00

System.setProperty(file.encoding, utf-8); The comment below implies that file.encoding would be changed for all apps

  • 0

System.setProperty(“file.encoding”, “utf-8”);

The comment below implies that file.encoding would be changed for all apps running on the same JVM, however, I don’t observe this kind of behaviour.

Setting a system property programmatically will affect all code running within the same JVM, which is hazardous, especially when discussing such a low-level system property.

I have read this question and understand that there are many issues with caching and Java 1.5
Setting the default Java character encoding?

Please, now consider the following code:

public class FileEncodingTest {
    public static void main (String[] args) {
        System.out.println(System.getProperty("file.encoding"));
        System.setProperty("file.encoding", "UTF-8");
        System.out.println(System.getProperty("file.encoding"));
    }
}

Then I create a jar-file using Eclipse and Java 1.6 set in project configuration.
Then I run jar-file with Java 1.7 and all this happens under Windows 7.

java -jar FileEncodingTest.jar
Cp1251
UTF-8

java -jar FileEncodingTest.jar
Cp1251
UTF-8

So who and why resets the value of file.encoding back to Cp1251?

UPD:
Anyone can explain or provide a link which explains step-by-step what happens in terms of JVM, processes when I type java -jar MyClass.jar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:40:03+00:00Added an answer on June 15, 2026 at 8:40 am

    you started 2 vm’s. one with each “java -jar” command.

    you can change the encoding your projects uses by editing the project properties in eclipse.

    but note that when you hardcode stuff that relies on the fileformat and another project uses your implementation there will be problems. thats what the comment means.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently setting a policy file using: policyURL =cl.getResource(res/policy/abc.policy); System.out.println(policyURL.toString()); System.setProperty(java.security.policy, policyURL.toString()); The
I would like to create a XML file which would have all the information
we currently experience some file writing/encoding problems that we cannot reproduce. Actually there are
In Java we use System.setProperty() method to set some system properties. According to this
What is the scope of System.setProperty()? If I set it in one of the
Here is my code : public static void main(String[] args) { // System.setProperty( //
System.Type contains an UnderlyingSystemType property. MSDN states that it: Indicates the type provided by
System.Web.Mvc has an HtmlHelper that contains a method called EditorFor that renders the editing
I would like to modify a properties file of a Portlet during runtime. The
I understand that the keystore would usually hold private/public keys and the trust store

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.