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

  • SEARCH
  • Home
  • 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 9165065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:49:43+00:00 2026-06-17T14:49:43+00:00

Main.scala: package controler object Main { def main(args: Array[String]) { import Utilites._ isJavaUpToDate }

  • 0

Main.scala:

package controler

object Main {
    def main(args: Array[String]) {
      import Utilites._
      isJavaUpToDate
    }
}

Utilites.scala:

package controler

object Utilities {
  def isJavaUpToDate = { 
    val javaVersion = augmentString(System.getProperty("java.version").substring(2, 3))
    javaVersion >= 6 
  }
}

Why isn’t this working?
I have been trought a bunch of differenet tutorial sites where this works no problem.

I always says that val Utilites cannot be found.

P.S. Why does it keep sugesting me to change .toInt with augmentString() when it just breaks the code?

Now this gives me trouble, something about implicit ordering and method orderTOOrdered.

  • 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-17T14:49:44+00:00Added an answer on June 17, 2026 at 2:49 pm

    Note that by calling augmentString you’re explicitly transforming your string to a StringOps.
    StringOps does define a >= method, but it’s meant to compare strings (its signature is def >=(that: String): Boolean )

    If you want to compare Ints you should use the toInt method defined in StringOps.

    def isJavaUpToDate = { 
        val javaVersion = augmentString(System.getProperty("java.version").substring(2, 3)).toInt
        javaVersion >= 6 
      }
    

    Also, unless you need to disambiguate the toInt against another implicit that you defined (or is defined somewhere else in a library you’re using) there should be no need to call augmentString explicitly. The following should just work (unless the compiler tells you it does not) and it should implicitly have the same effect as the code above of transforming your String to a StringOps.

    def isJavaUpToDate = { 
        val javaVersion = System.getProperty("java.version").substring(2, 3)
        javaVersion.toInt >= 6 
      }
    

    EDIT: as per @som-snytt’s comment
    The error you’re getting (No implicit Ordering defined for AnyVal) is due to the compiler reasoning more or less like this:

    • javaVersion >= 6 means javaVersion.>=(6), i.e. I must look for a method called >= on javaVersion that takes an integer
    • javaVersion is a StringOps… there is a >= method in StringOps (courtesy of the StringLike trait it’s extending, that in turn extends Ordered[String]) but it takes a String argument, not an Int
    • let’s see if I have an implicit in scope that supplies a suitable Ordering for StringOps. Now, since you’re trying to compare a String with a Int you’re looking at an Ordering that can compare two values with the nearest common ancestor that can contain both String and Int, i.e. AnyVal [EDIT: although String is an AnyRef so I don’t really get this part…].
    • No luck there… give up with an error that says that no implicit Ordering was found comparing AnyVals
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import org.apache.tools.ant.Project object HelloWorld { def main(args: Array[String]) { println(Hello, world!) } } I
Consider the following Scala code: package scala_java object MyScala { def setFunc(func: Int =>
On compiling the following code with Scala 2.7.3, package spoj object Prime1 { def
When I run my Scala hello world application, like package pack object App {
I have the following situation. My project has a main.scala.html file and a folder
I am working in a Scala embedded DSL and macros are becoming a main
Is there a way to tell sbt to package all needed libraries (scala-library.jar) into
In Scala, you can define package objects . It seems thus that you can
I'm obviously missing something fundamental here. I have the following Scala Code: package org.carlskii
I'm trying to package a scala project into a jar and write properties to

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.